wait,notify came into existance due to old
Thread methods
suspend, stop,resume.
These methods have failed to manage locks obtained.
causing deadlocks.
To work with or manage locks wait and notify are introduced.
wait() -> releases the obtained lock and waits to get notified.
notify() -> notifies another thread(s) waiting on that object.
We can't handle the locks out side the synchronized() block. we can't creep into monitor state.
Thats wait,notify placed in Object sothat we can effectively manage the locks obtained on any Object.
[ August 11, 2007: Message edited by: Srinivasan thoyyeti ]