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


Please Help Members By Posting Answers For Below Questions

What is java Applet?

640


Explain creating threads by implementing runnable class?

579


What is the importance of main method in Java?

567


Is java se open source?

560


What is hashing in java?

558






What occurs when an object is constructed?

559


What is the use of parse function in java?

505


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?

2625


What is outofmemoryerror in java?

557


What do you mean by garbage collection used in java?

565


What is api in java?

529


What is the flag in java?

602


Why main method is called first in java?

537


What are predefined functions?

563


Is it possible for a yielded thread to get chance for its execution again?

505