java swing timer sleep

Solutions on MaxInterview for java swing timer sleep by the best coders in the world

showing results for - "java swing timer sleep"
Kurt
14 Aug 2018
1System.out.println("Hi");
2//Now it will pause
3try{
4  Thread.sleep(5000)//Time in milliseconds->5000==5 seconds 
5  //^freezes whole program for amount of time
6  System.out.println("Hola");//Appears after 5 seconds
7}
8catch(InterruptedException e){
9  System.err.println(e.getMessage());
10}