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 is the mapping mechanism used by java to identify IDL language?
What is externalizable interface?
What are the different ways to handle exceptions?
What is equlas() and hashcode() contract in java? Where does it used?
Can we overload run() method in java?
What are filterstreams?
Is linked list a linear or non-linear data structure?
How can I debug the Java security exceptions and AccessControlExceptions?
What 5 doubled?
How do we access static members in java?
What is the old name of java?
How variables are stored in memory?
What is variable and example?
What is the use of singleton?
Is it possible to instantiate the abstract class?