posted 21 years ago
Yes, right. Now, let�s describe what �placed under� means.
wait, notify and notifyAll may be invoked only by a thread that holds the
synchronization lock of the object on which the method is invoked.
The invocation can be made directly in a method or block of code declared as
synchronized, or can be made indirectly from a method invoked in such code.
Compliance generally cannot be verified at compile time. Failure to comply causes
these operations to throw an IllegalMonitorStateException at run time.
You can use the static method Thread.holdsLock(Object o) in your practice
programs to show you whether the current thread holds a lock.
[ June 22, 2003: Message edited by: Marlene Miller ]