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
What is polymorphism in java? What are the kinds of polymorphism?
What is a programming object?
What is object cloning in Java?
What are measurable parameters?
Compare overloading and overriding?
Can we have any code between try and catch blocks?
What 4 doubled?
What is an example of a boolean?
When can you say a graph to be a tree?
What is byte value?
What is dynamic array in java?
What is package private scope in java?
How do you add an element to an arraylist in java?
What are accessor methods in java?
Can we overload the constructors?