SCJP Module-6 Question-30

The sample program given below will test your understanding of sequence of execution, of catch block in exception handling.

 
 

Share on Google+Share on Google+

SCJP Module-6 Question-30

Ads

The sample program given below will test your understanding of sequence of execution, of catch block in exception handling.

Given below the sample code :

1 try {
2 // code
3 } catch (NullPointerException ne) {
4 System.out.print("NullPointerException ");
5 } catch (RuntimeException re) {
6 System.out.print("RuntimeException ");
7 } finally {
8 System.out.print("END");
9 }

If NullPointerException is trown at line number 2, What will be the output of the above code?

1.Compilation error

2.NullPointerException .

3.NullPointerException  RuntimeException  END

4..NullPointerException  END

Answer

(4)

Advertisements

Posted on: July 15, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles