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 the difference between reader/writer and inputstream/output stream?
What are different types of inner classes ?
What is thread pool in java with example?
How many tetrahedral voids are there in bcc?
Is main is a keyword?
You're given a Boolean 2D matrix, can you find the number of islands?
What are thread local variables?
What is the functionality of the stub?
How many types of constructors are used in java?
How we can make copy of a java object?
How do you compare characters in java?
Can we have any other return type than void for main method?
What is stringbuffer in java?
what is thread? What are the high-level thread states? : Java thread
What is parsing a sentence?