How can I delay a Java program for a few seconds?
<p>I have tried to delay - or put to sleep - my Java program, but an error occurs and I'm unable to debug it.
I am new to Java, and I'm trying to println something after waiting a few second.</p>

<p>I'm unable to use Thread.sleep(x) or wait().
The same error message appears: 
"unreported exception java.lang.InterruptedException; must be caught or declared to be thrown."</p>

<p>Is there any step required before using the thread.sleep() or wait() methods? Do I need to import any library to use them?</p>
