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
What is java Applet?
Explain creating threads by implementing runnable class?
What is the importance of main method in Java?
Is java se open source?
What is hashing in java?
What occurs when an object is constructed?
What is the use of parse function in java?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is outofmemoryerror in java?
What do you mean by garbage collection used in java?
What is api in java?
What is the flag in java?
Why main method is called first in java?
What are predefined functions?
Is it possible for a yielded thread to get chance for its execution again?