title: I get exception when using Thread.sleep(x) or wait()
body: <p>I have tried to delay - or put to sleep - my Java program, but an error occurs.</p>
  
  <p>I'm unable to use <code>Thread.sleep(x)</code> or <code>wait()</code>. The same error message appears: </p>
  
  <blockquote>
    <p>unreported exception java.lang.InterruptedException; must be caught or declared to be thrown.</p>
  </blockquote>
  
  <p>Is there any step required before using the <code>Thread.sleep()</code> or <code>wait()</code> methods?</p>