Hi Guys,
The following is from the K&B book. Page 720.
The explanation given as, "Notice in line 6 the code synchronizes itself with the object b- this is because in order to call wait() on the object. ThreadA must own a lock on b. For a
thread to call wait() or notify(), the thread has to be the owner of the lock for that object.
So from my understanding, at line 6 which is in ThreadA, when we say synchronized(b), it means that ThreadA has locked ThreadB. Is that what I can infer?? This may sound dumb and stupid, but ranchers, please help me understand this.
Thanks in advance.