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 / souvik

The answer will be first option B since the object created is of B type and it is calling directly the process method in B class

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is arraylist dynamic in java?

704


What is class forname?

720


Why pointers are not used in java?

801


How do you square a number?

842


What is the advantage of preparedstatement over statement?

799


Is arraylist zero based?

750


What is the final method?

796


What is immutability in java?

788


What is the program compilation process?

761


Why do we need hashmap in java?

739


What are static initalizers in java ?

751


What is this () in java?

741


What is jagged array in java?

727


Why do we need variables?

710


what is thread? What are the high-level thread states? : Java thread

997