Details of code :
A Messenger (extends
Thread) will update the value of an
Integer M using a for loop. After each iteration it will wait() on M. Then, an Announcer (extends Thread) will simply
print this number and notify() . The messenger should generate numbers 1 to 10 and the Announcer should read them. And the program below throws an exception :
CODE HANGS WITH THIS OUTPUT :