public class Test
{
public static void main(String [] args)throws Exception
{
Object object = new Object();
synchronized (Thread.currentThread())
{
object.wait();
object.notify();
}
}
}
What is the result?
Options
- Compiles successfully.
- Throws an InterruptedException.
- Throws an IlleagalStateException.
- Throws an IllegalMonitorStateException
CORRECT ANSWER : Throws an IllegalMonitorStateException
Write your comments