wait and sleep method in java code example
Example 1: java sleep in code
import java.util.concurrent.TimeUnit
TimeUnit.SECONDS.sleep(1);
or
TimeUnit.MINUTES.sleep(1);
Example 2: 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.