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

 
 

Share on Google+Share on Google+
SCJP Module-6 Question-21
Posted on: July 15, 2010 at 12:00 AM
Advertisement
The sample program code will test your logic in Java programming and help you in better understating of Java program.

Given below the sample code :

class Main {
static String a = "&&";
public static void main(String[] args) {
new Main().a1();
System.out.println(a);
}
void a1() {
try {
a2();
} catch (Exception e) {
a += "x";
}
}
void a2() throws Exception {
a3();
a += "7";
a3();
a += "7x";
}
void a3() throws Exception {
throw new Exception();
}
}

What will be the output of the following code ?

1.Compilation error

2.&&7

3.&&7x

4.-x

Answer

(4)

Advertisement

Related Tags for SCJP Module-6 Question-21:


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