ProAnswers.org

What is the difference between notify() and notifyAll()?

notify() is used to unblock one waiting thread whereas notifyAll() method is used to unblock all the threads in waiting state.

notify wakes up a single thread that is waiting for object’s monitor. If any threads are waiting on this object, one of them is chosen to be awakened. The choice is arbitrary and occurs at the discretion of the implementation. notifyAll Wakes up all threads that are waiting on this object’s monitor. A thread waits on an object’s monitor by calling one of the wait methods.