| Author |
IllegalMonitorStateException doubt
|
Deepak Borania
Ranch Hand
Joined: Jul 28, 2009
Posts: 45
|
|
GIven the following code :
Can someone please tell me why does the above code result in IllegalMonitorStateException at runtime?
And please explain a little about synchronized code blocks. I just can't seem to get hang of them.
Thanks
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
You synchronize on whatever.class, then try to get the lock on "this". You can only call wait, notify and notifyAll on objects you synchronize on.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: IllegalMonitorStateException doubt
|
|
|