Hi everyone, did someone programming using the wait and notify methods of the object class. this is the way the class was, there was a clas that had 2 functions, one to store a value in a string, the other to retrieve values from thesame string. Also wrote a class to call the retrieve method of the class above, designed it in such a way that if there is no value in the string it will wait till a value is stored Wrote another class, to call the store method of the first class, after storing the value it calls the notify() method to reawaken the thread that is waiting. But I noticed that the thread I was waiting for did not reawaken and instead the thread only awoke the thrid class and not the second class. What do you think I can do to this program
notify() will just wake up one of the threads that's waiting - so if there is more than one, there is no guarantee which one. Often it's more safe to use notifyAll() instead.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus