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
Outline the major features of java.
How to reverse a string in java?
What do you mean by byte code?
What are the two ways of implementing multi-threading in java?
Explain the scope of a variable.
What is meant by bytecode?
How do you calculate roots in java?
What is the use of static class?
How many threads does a core java have?
What is a loop java?
Is a case study a method or methodology?
what is the purpose of the runtime class?
What is a constructor overloading in java?
what is object slice?
How many classes can any class inherit java?