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

 
   
 
 

Enter the code shown above:
 
(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement