Wait

Differences between wait() and sleep() or sleep() and yield() method in Java Thread is one of the very old questions asked in Java interviews. Though both wait and sleep put threads to the waiting state, they are completely different in terms of behavior and use cases. JavaDoc Definition Thread Class public static void sleep(long millis[, int nanos]) throws InterruptedException Causes the currently executing thread to sleep (temporarily cease execution) for the specified number of milliseconds plus the specified number of nanoseconds, subject to the precision and accuracy of system timers and schedulers.