Sandeep Kumar B wrote:
I was expecting that since in the loop sleep(100) is more than wait(1), wait statement would stop waiting and print the Total in the middle of the calculation
but after wait period i.e. 1 miliseconds is over main thread will have to reacquire the lock on ThreadB object b,
so it will block for lock on b to be released, sleep() method call in ThreadB does not cause lock to be released,
so lock of b is still with ThreadB.