Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

java pause 1 second

//deprecated in main thread:
try {
  Thread.sleep(1000);//time is in ms (1000 ms = 1 second)
} catch (InterruptedException e) {e.printStackTrace();}

//please use bellow instead:
Timer timer = new Timer();
timer.schedule(new TimerTask() {
  @Override
  public void run() {
    //what you want to do
  }
}, 1000);//wait 1000ms before doing the action
Comment

java sleep 1 second

import java.util.Date;
public class JavaHungry {
    public static void main(String args[]) {
      try
      {
        System.out.println("Start of delay: "+ new Date());
        // Delay for 7 seonds
        Thread.sleep(7000);   
        System.out.println("End of delay: "+ new Date());
      }
      catch(InterruptedException ex)
      {
          ex.printStackTrace();
      }
    }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: “javascript sleep 1 second 
Javascript :: js loop every second 
Javascript :: js first letter uppercase 
Javascript :: javascript difference between two dates 
Javascript :: jquery remove and add class 
Javascript :: self executing async function in js 
Javascript :: dinosaur game 
Javascript :: Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If 
Javascript :: createroot react 
Javascript :: ajax get request 
Javascript :: Javascript adding zeros to the beginning of a string 
Javascript :: es module __dirname alternative 
Javascript :: javascript check if not undefined 
Javascript :: nodejs atob 
Javascript :: Slick slider arrows change 
Javascript :: 1 line uuid 
Javascript :: how to store objects in localstorage 
Javascript :: jquery on body click 
Javascript :: python save list to json 
Javascript :: javascript current date add 30 days 
Javascript :: jquery delete grand parent of clicked element 
Javascript :: javascript screen size 
Javascript :: Extract number from string javascripy 
Javascript :: cypress backspace 
Javascript :: link next js target _blank 
Javascript :: disable anchor tag jquery after click 
Javascript :: kill node 
Javascript :: react doesnt load local images but external does 
Javascript :: jquery add option to select 
Javascript :: javascript sort by numerical value 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =