Difference between “wait()” vs “sleep()” in Java
A wait can be “woken up” by another thread calling notify on the monitor which is being waited on whereas a sleep cannot. Also a wait (and notify) must happen in a block synchronized on the monitor object whereas sleep does not: Object mon = …; synchronized (mon) { mon.wait(); } At this point the … Read more