11. static class A {
12. void process() throws Exception { throw new Exception();
}
13. }
14. static class B extends A {
15. void process() { System.out.println(”B”); }
16. }
17. public static void main(String[] args) {
18. new B().process();
19. }
What is the result?
1 B
2 The code runs with no output.
3 Compilation fails because of an error in
line 12.
4 Compilation fails because of an error in
line 15.
Answer Posted / manikandan [ gtec,vellore ]
Answer is 1)B because we directly calling a process method
in class B
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is the use of a copy constructor?
What is the purpose of the strictfp keyword?
What class of exceptions are generated by the java run-time system?
Explain which of the following methods releases the lock when yield(), join(),sleep(),wait(),notify(), notifyall() methods are executed?
What is array and arraylist in java?
What is type conversion in java?
What are the differences between abstract class and interface?
Is 64bit faster than 32 bit?
What are the advantages of compiled language?
What is methodological framework?
What is a “stateless” protocol ?
What are the three parts of a lambda expression?
Can singleton class be serialized?
Which is easier .net or java?
How do constructors use this() and super()?