What Notifyall() Method Do?
The notifyAll Method Wakes up All Threads Waiting on the Object in Question (In This Case, the Cubbyhole ). .. . One Thread Gets It, and the Others Go Back to...
The notifyAll method wakes up all threads waiting on the object in question (in this case, the CubbyHole ). ... One thread gets it, and the others go back to waiting. The Object class also defines the notify method, which arbitrarily wakes up one of the threads waiting on this object.
What is the purpose of wait notify and notifyAll methods?
The wait() method causes the current thread to wait until another thread invokes the notify() or notifyAll() methods for that object. The notify() method wakes up a single thread that is waiting on that object's monitor. The notifyAll() method wakes up all threads that are waiting on that object's monitor.
What is difference between notify () and notifyAll ()?
Notification to number of threads : We can use notify() method to give the notification for only one thread which is waiting for a particular object whereas by the help of notifyAll() methods we can give the notification to all waiting threads of a particular object.