10 Replies Latest reply: Dec 4, 2006 8:19 AM by dcminter RSS

    Use of thread.sleep()

    807598
      Hi!.

      I have the following code:

      public void X(){
      System.out.println("Hi");
      Thread.sleep(3000);
      System.out.println("Bye");
      }

      When I compile this program, the following error ocurr:

      Lamp.java:46: unreported exception java.lang.InterruptedException; must be ca
      ught or declared to be thrown
      Thread.sleep(3000);
      ^
      1 error

      Someone please can help me with the correct syntax of thread.sleep?. I was looking for it in google, but I dont found it.

      Best regards