Hi,
I am a bit confused about how synchronization keyword works regarding acquiring lock.
In my method if I do like this,
....so it means that synchronized block has the object ,on which method is called ,as monitor. Hence we can call
wait() method on that object. But if instead I use some other object as monitor then I suppose that I can't call wait() on current object
as now
thread gets lock on that monitor object and not on the current object.
But what I see is that I am still able to call wait on current object while I was expecting IllegalMonitorStateException.
Where is my understanding wrong?
Manish