The problem is that you moved one line , "calculator.start();", above the other calls to start(). This statement immediately starts a
thread with Calculator's run() method from the main thread. Calculator.run() takes the lock on the Calculator object, counts from 0 to 99, issues a notifyAll() with no one waiting, and returns to main().
Only now do the "new Reader(calculator).start();" statements start 3 more threads that reach the "c.wait();" statement in run() and wait. Notice that these 3 threads synchronize on the Calculator object but never call the Calculator.run() method.
So, no one issues another notifyAll() on the Calculator object and the threads wait forever.
Now, see if you can explain the difference with "calculator.start();" back at the bottom of main().
[ December 27, 2004: Message edited by: Mike Gershman ]
[ December 27, 2004: Message edited by: Mike Gershman ]