Hi.
I am reading chapter 9 and so far finding it quiet challenging. I am on
thread interaction topic currently
from kathy and sierra and i have the following confusion. This is the sample code from Kathy and Bert
examination guide.
Now as there are two threads in this example. ThreadA and ThreadB. Confusion is, when ThreadB enteres the run
method, it acquires the lock on the instance b, who invoked it. Now if it was not the case, ThreadA can print the
total before ThreadB finishes counting. But when ThreadB has already got the lock on b instance, how can ThreadA
invoke wait on it, as it doesn't own the lock. I know i am not understanding the topic correctly. Please help me where
am i getting wrong.
Arhaan