Saturday, 25 May 2013

Exception - 21 -

Given this code snippet: 
try { 
tryThis(); 
return; 
} catch (IOException x1) { 
System.out.println("exception 1"); 
return; 
} catch (Exception x2) { 
System.out.println("exception 2"); 
return; 
} finally { 
System.out.println("finally");
}


What will appear in the standard output if tryThis() throws a NumberFormatException? 
Select the one right answer. 
a) Nothing 
b) "exception 1", followed by "finally" 
c) "exception 2", followed by "finally" 
d) "exception 1" 
e) "exception 2" 



 try { 
tryThis(); 
return; 
} catch (IOException x1) { 
System.out.println("exception 1"); 
return; 
} catch (Exception x2) { 
System.out.println("exception 2"); 
return; 
} finally { 
System.out.println("finally");
}


Answers.:- c

No comments:

Post a Comment