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 / r.jainrocks@gmail.com

Compilation fails

static keyword not allowed here
at line 11 and 14

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism in java? What are the kinds of polymorphism?

796


What is a programming object?

766


What is object cloning in Java?

844


What are measurable parameters?

783


Compare overloading and overriding?

777


Can we have any code between try and catch blocks?

750


What 4 doubled?

740


What is an example of a boolean?

793


When can you say a graph to be a tree?

838


What is byte value?

745


What is dynamic array in java?

745


What is package private scope in java?

711


How do you add an element to an arraylist in java?

692


What are accessor methods in java?

753


Can we overload the constructors?

752