Class Test
{
public static void main(String [] args) throws Exception
{
try{
test();
}catch (IOException e) {
System.out.println("IOException thrown");
}catch(Exception e)
{
System.out.println("Exception thrown");
}
}
public static void test()
{
throw new IOException();
}
}
What would be the result?
Options
- The output is IOException thrown.
- The output is Exception.
- The code will not compile.
- The program will run normarlly.
CORRECT ANSWER : The code will not compile.
Write your comments