Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question related to exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Question related to exception" Watch "Question related to exception" New topic
Author

Question related to exception

Gitesh Ramchandani
Ranch Hand

Joined: Feb 28, 2007
Posts: 274
Source MinQ -Q31

Consider the code below:
void myMethod()
{ try
{
fragile();
}
catch( NullPointerException npex )
{
System.out.println( "NullPointerException thrown " );
}
catch( Exception ex )
{
System.out.println( "Exception thrown " );
}
finally
{
System.out.println( "Done with exceptions " );
}
System.out.println( "myMethod is done" );
}
What is printed to standard output if fragile() throws an
IllegalArgumentException?
a) "NullPointerException thrown"
b) "Exception thrown"
c) "Done with exceptions"
d) "myMethod is done"
e) Nothing is printed

Ans: B,C,D

Doubt: How D.

Regards,
Gitesh
V Gala
Ranch Hand

Joined: Aug 06, 2007
Posts: 113
All the code after the try block is executed after the caught or finally code is executed
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question related to exception
 
Similar Threads
From mIND q TEST some ques
Exception
Exceptions
MindQ Q31
another question from MindQ Mock Exam