=======================================================================
"waiting and notifying are means of communication between threads
that synch on the same object. These methods can only be executed
on an object whose lock the thread holds, otherwise it will result
in an IllegalMonitorStateException"
=======================================================================
Thr r two threads threadA & threadB, holding lock on the same object 'obj'.
Assume at this instant threadA is excuting obj, as soon it is done/ or its time slice completes; It need to intimate threadB to PROCEED with obj, for this threadA calls notify() on obj, in turn obj wll intimate its threads to proceed with further execution.
A thread not concerned with an object (ie not holding a lock on it), cant command the object for intimation. If this happens an 'IllegalMonitorStateException' is thrown.
" i cnt call my friends(sm othr thread) gal(sm other object) to do good things (to perform sm action) bcoz the THREAD is with my friend(the othr thread). "
HOPE THIS MAKE SENSE.