SCJP Module-6 Question-20

The program given below will check your understanding of how to caught Exceptions in sequence in Exception Handling in Java.

 
 

Share on Google+Share on Google+

SCJP Module-6 Question-20

Ads

The program given below will check your understanding of how to caught Exceptions in sequence in Exception Handling in Java.

Given below the sample code :

try {
// code
} catch (NullPointerException npe) {
System.out.print("hello");
} catch (RuntimeException rte) {
System.out.print("brothers");
} finally {
System.out.print("sisters");
}

What will be the output of the above code ?

1. Compilation error

2. hello brothers

3 hello brothers and sisters

4.hello sisters.

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