I have the similar doubt regarding wait() and notify(). the scenario is somewhat like this " when one
thread A is executing synchronized method and done with it, eventually it notifies with notifyall(). while the main thread which want to use the result of that thread A, then why we need to invoke wait() method on thread A instead the main thread is waiting ",
-i don't get it correctly, ,may its because when wait() is encountered by the instance of thread A it will release the lock., if so then thread A should release the all when it hits the notifyall()in sync code.
- please correct me if i am wrong somewhere.
- thank you