| Author |
IllegalMonitorStateException
|
Paul Michael
Ranch Hand
Joined: Jul 02, 2001
Posts: 697
|
|
i created these classes and got that exception. i tried using the synchronized(this) statement instead and it worked... it's a bit confusing because letters and numbers are two diff objects and i'm wondering why my first aproach didn't work... hewp! 
|
SCJP 1.2 (89%), SCWCD 1.3 (94%), IBM 486 (90%), SCJA Beta (96%), SCEA (91% / 77%), SCEA 5 P1 (77%), SCBCD 5 (85%)
|
 |
Marcela Blei
Ranch Hand
Joined: Jun 28, 2000
Posts: 477
|
|
if you look at the API doc. at the Object.notify method for example, you can find the following: A thread becomes the owner of the object's monitor in one of three ways: -By executing a synchronized instance method of that object. -By executing the body of a synchronized statement that synchronizes on the object. -For objects of type Class, by executing a synchronized static method of that class. So, what does this mean: That you have to own the thread�s monitor for using notify, for example. Read the API doc carefully for a deep detail of the following methods from Object: notify, wait, notifyAll.
|
 |
Paul Michael
Ranch Hand
Joined: Jul 02, 2001
Posts: 697
|
|
i see!!! i should have specifically used the letters.notify()/letters.notifyAll() and numbers.notify()/numbers.notifyAll() instead! thanks a lot Marcela Blei!!!
|
 |
 |
|
|
subject: IllegalMonitorStateException
|
|
|