You are not logged in.

#1 2015-06-10 10:32:06

husnain
User RankUser RankUser RankUser RankUser RankUser Rank
Administrator
From: Chichawatni,Pakistan
Registered: 2014-10-03
Posts: 8,129
Website

Class Test:

Directions:
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();
}

}

Question:
What would be the result?

Option A):
The code will not compile
Option B):
The output is Exception
Option C):
The program will run normarlly
Option D):
The output is IOException thrown

Correct Answer is Option A):
The code will not compile


You cannot discover the new oceans unless you have the courage to lose the sight of the shore.

2015-06-10 10:32:06

Advertisement
Ads By Google

Re: Class Test:



\n

Board footer