Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java wait

// Sleep 1 second
TimeUnit.SECONDS.sleep(1);
// Sleep 1 minute
TimeUnit.MINUTES.sleep(1);
Comment

how to wait in java

//1000 is the number of milliseconds (1000 milli = 1 second)
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
  //Thread.sleep always throws an exception once done so this breaks
  Thread.currentThread().interrupt();
}
//to make it fancy you can make a new method
public static void wait (int sec)  {
    sec *= 1000;
    try { //scroll down
  Thread.sleep(sec);
} catch (InterruptedException e) {
  Thread.currentThread().interrupt();
}
  }
//now just do
wait(1);
//this will wait for 1 second
Comment

wait method in java

java.lang.Object.wait() causes current thread to wait until another thread 
invokes the notify() method or the notifyAll() method for this object.
Comment

PREVIOUS NEXT
Code Example
Java :: concatenating two int in java 
Java :: how to print a matrix in java 
Java :: java remove non numbers from string 
Java :: random string method java 
Java :: spigot scheduler 
Java :: java delete directory 
Java :: java add commas to numbers 
Java :: spring load config value in variable 
Java :: jframe add label java 
Java :: localdatetime to xmlgregoriancalendar 
Java :: finding absolute value in java 
Java :: java how to get fps 
Java :: how to make an invisiblke button in swing 
Java :: flutter request location permission 
Java :: update value in hashmap java 
Java :: keytool error: java.lang.Exception: Keystore file does not exist: ~/.android/debug.keystore 
Java :: joptionpane.showmessagedialog 
Java :: regex get string between quotes java 
Java :: jakkala siva venkata deepesh 
Java :: create list of booleans java 
Java :: java string to char array 
Java :: how to create listpopupwindow android studio 
Java :: geting max value in priority queue java 
Java :: convert list to map java 
Java :: Spring Boot Hibernate remove underscore naming strategy 
Java :: android display drawable in imageview 
Java :: programmation android avoir acces à la liste des instants de partage 
Java :: Date from String java11 
Java :: lombok maven 
Java :: android onlcik java 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =