We have this program on K&B book:
I didnt get whats happenign in this code.
Getting the output:
-----------------------------
Waiting for b to complete...
Total is: 4950
-----------------------------
On line we are startign the
thread, tha tmeans control will come to line 19 and calculates the totals in teh for loop, and when it comes to line 24 there is notigy() method. In order to call notify() method, we should have called wait() method on that particular object. But we are calling notify() method from run() method itself, but calling wait() method at line 9 which will be executed after run() method completion.
And why gettig the above output??
I didnt get whats happening in this code at all, Pls explain me thouroughly .....
Thanks.