Thread b's run() could complete even before line 5 is reached.
If the notify() in thread b is executed before the wait() in the main thread then it is just thrown away.
So the main thread could execute the wait() with no notify arriving to release it. wait() is the same as wait(0) which means wait until notified (or interruptrd).
[ June 23, 2004: Message edited by: Barry Gaunt ]