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

 
 

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

Related Tags for SCJP Module-6 Question-21:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.