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
Explain the difference between private, public, package and protected in java?
What is the difference between class & object?
How to create an immutable class?
What is difference between array and vector?
What is listnode in java?
What do you mean by boolean?
How does a for loop work java?
What is difference between class and object in java?
What are use cases?
Does google use java?
What are the methods to rectify ambiguities in the interfaces in JAVA?
What is the purpose of format function?
What is difference between ++ I and I ++ in java?
What is contractor means and methods?
List types of storage classes in java?