Pausing the Current Thread: a thread can temporarily stop execution. : Sleep Pause « Thread « Java Tutorial






public class Main {
  public static void main(String[] argv) throws Exception {
    long numMillisecondsToSleep = 5000; 
    Thread.sleep(numMillisecondsToSleep);
  }
}








10.18.Sleep Pause
10.18.1.Pause the execution
10.18.2.Pausing the Current Thread: a thread can temporarily stop execution.
10.18.3.Add a delay
10.18.4.Pause the execution of a thread using sleep()