33. try {
34. // some code here
35. } catch (NullPointerException e1) {
36. System.out.print(”a”);
37. } catch (RuntimeException e2) {
38. System.out.print(”b”);
39. } finally {
40. System.out.print(”c”);
41. }
What is the result if a NullPointerException occurs on line
34?
1 c
2 a
3 ab
4 ac

Answer Posted / guest

1)
try {
throw new NullPointerException();
} catch (NullPointerException e1) {
System.out.print("a");
} catch (RuntimeException e2) {
System.out.print("b");
} finally {
System.out.print("c");
}
Ans: ac
2) try {
new NullPointerException();
} catch (NullPointerException e1) {
System.out.print("a");
} catch (RuntimeException e2) {
System.out.print("b");
} finally {
System.out.print("c");
}
Ans: c

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are instance variables?

612


How will you initialize an Applet?

621


If a class is declared without any access modifiers, where may the class be accessed in java programming?

659


What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?

518


What is a loop java?

587






Why is stringbuffer not immutable?

568


What is :: operator in java 8?

558


Can main() method in java can return any data?

646


How do I print a “?

577


What is the use of coding?

519


Is it possible to instantiate the abstract class?

540


What is finally and finalize in java?

594


Give us the name of the list layoutmanagers in java?

522


What are thread groups?

576


Why is java multithreaded?

542