Home Tutorial Java Scjp Part6 SCJP Module-6 Question-23

 
 

SCJP Module-6 Question-23
Posted on: July 15, 2010 at 12:00 AM
The Sample program code given below will test your understanding of try, catch block in Java.

Given below the sample code :

public class Base {
static String str = "-";

public static void main(String[] args) {
try {
throw new Exception();
} catch (Exception e) {
try {
try {
throw new Exception();
} catch (Exception ex) {
str += "MI ";
}
throw new Exception();
} catch (Exception x) {
str += "NU ";
} finally {
str += "S ";
}
} finally {
str += "SIGN ";
}
System.out.println(str);
}
}

What will be the output of the above code?

1.No output

2.S SIGN

3.MI NU S SIGN

4.- MI NU S SIGN

Answer

(4)

Related Tags for SCJP Module-6 Question-23: