SCJP Module-6 Question-20


 

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.

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)

Ads