wait and notify must be called on THE SAME EXACT OBJECT.
To coordinate two threads using wait and notify, they must use one object.
You'll need an object for each case where a thread has to wait...
Type: Posts; User: Norm
wait and notify must be called on THE SAME EXACT OBJECT.
To coordinate two threads using wait and notify, they must use one object.
You'll need an object for each case where a thread has to wait...
The wait and the notify should be on the same object. Your code shows different objects.
Read the API doc for those methods.
They will continue to execute if they don't return from the run() method.
Which thread? The one that is waiting for more data in the linked list or the one that has just added to the list?
What do you want the code to do?
What does the API doc say about calling start() and run() more than once?