I am confused with thread exceptions. can someone please explain the difference in the exceptions InterruptedException, IllegalMonitorStateException, IllegalThreadStateException.
which exception th wait() method should be wrapped in?
InterruptedException is thrown when any thread is interrupted while it has executed sleep() or wait(). IllegalMonitorState Exception is thrown when any thread executes wait() without holding a lock on an object.
InterruptedException must be handled via try..catch or must be declared in the method defintion. IllegalMonitorState is thrown by JVM..