Java / Java Multithreading
Difference between a wait() and sleep() in Threads.
A wait can be "woken up" by another thread calling notify on the monitor which is being waited on whereas a sleep cannot.
A wait (and notify) must happen in a block synchronized on the monitor object whereas sleep does not.
You call wait on Object itself whereas you call sleep on Thread.
While sleeping a Thread does not release the locks it holds, while waiting releases the lock on the object that wait() is called on.
More Related questions...