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

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-23
Posted on: July 15, 2010 at 12:00 AM
Advertisement
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)

Advertisement

Related Tags for SCJP Module-6 Question-23:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 15, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com