What will happen when you compile and run the following code.
public class X
{
public static void main(String argv[])
{
try
{
while (true)
{
new Object().wait();
}
}
catch (InterruptedException e)
{
System.out.println("InterruptedException");
}
catch (RuntimeException e)
{
System.out.println("RuntimeException");
}
catch (Exception e)
{
System.out.println("Exception");
}
}
}
A) Error: "No such method 'wait'"
B) The program will start and exit without any output.
C) Output RuntimeException.
D) Output Exception.
E) Output InterruptedException.
F) The program will run forever in while (true) loop.