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
Explain different forms of polymorphism?
Name the components that are termed to be Heavy-weight component but available in Light-weight components?
Where are variables stored?
What is jpa specification?
What is private static in java?
What is a default constructor and also define copy contrucyor?
What does indexof mean?
How large is a boolean?
Can you use this() and super() both in a constructor?
What is bytecode in java ?
What is 32 bit float?
What is the purpose of the main method?
What are the different conditional statements?
Does google use java?
Why is boolean important?