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 a percentage sign called?
What are the 6 boolean operators?
What is the use of private static?
What are unchecked exceptions in java?
What is strings in java?
What are encapsulation, inheritance and polymorphism?
What is boolean strategy?
Is constructor inherited?
What does indexof mean?
What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?
What is boolean keyword in java?
What does flag mean in java?
What are peerless components in java programming?
What do you mean by platform independence of Java?
What does java ide mean?