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
What are instance variables?
How will you initialize an Applet?
If a class is declared without any access modifiers, where may the class be accessed in java programming?
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 ?
What is a loop java?
Why is stringbuffer not immutable?
What is :: operator in java 8?
Can main() method in java can return any data?
How do I print a “?
What is the use of coding?
Is it possible to instantiate the abstract class?
What is finally and finalize in java?
Give us the name of the list layoutmanagers in java?
What are thread groups?
Why is java multithreaded?