Check the
API.
In a
previous post in response to a similar question I pointed out that
Object api on wait method:
This method should only be called by a thread that is the owner of this object's monitor. See the notify method for a description of the ways in which a thread can become the owner of a monitor.
...
IllegalMonitorStateException - if the current thread is not the owner of the object's monitor.
Object api on notify method:
This method should only be called by a thread that is the owner of this object's monitor. 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.