what happen when we call the Wait(),Notify() and NotifyAll() methods in the Thread?
The wait(),notify(), and notifyAll() methods are used to provide an efficient way for threads to wait for a shared resource.
When you call the wait() method, it enters the waiting state. It only enters the ready state after another thread invokes the object's notify() or notifyAll() methods.
* wait( ) tells the calling thread to give up the monitor and go to sleep until some other thread enters the same monitor and calls notify( ). * notify( ) wakes up the first thread that called wait( ) on the same object. * notifyAll( ) wakes up all the threads that called wait( ) on the same object. The highest priority thread will run first.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.