Originally posted by Buhi Mume: O oh... does this mean the book explanation (on page 721) is wrong?
If it is wrong, how to correct it?
I don't have enough information to determine the content of the statement, but thread A does continue with the next line of code in its own class. Now, whether it will do it before thread B starts executing the run() method -- that is not guarranteed.
The book (p. 529 in 1.4 book) fails to point out this problem.
I guess the example is very basic, so as to not overwhelm the reader.
In the following book example, both threads are in an infinite loop. In this case, it doesn't matter which thread gets the lock first. If the notifying thread notifies the other thread before it starts waiting, it will notify it again the next time through the loop.