Sleeping for a While : Sleeping « Thread « SCJP






The Thread that calls the sleep method is put to sleep for a number of milliseconds 
at least equal to the input parameter. 


1. Thread.sleep(long millisecs)
2. Thread.sleep(long millisecs, int nanosecs )


public class MainClass {
  public static void main(String[] argv) {
    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
    }

  }
}








7.7.Sleeping
7.7.1.Thread.sleep()
7.7.2.Sleeping for a While