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

Explain wrapper classes in java?

641


Difference between notify() method and notifyall() method in java?

640


How do you escape a string?

602


What is the core java?

628


Can variables be used in java without initialization?

642






What is compareto () in java?

622


What is the difference between the size and capacity of a vector?

644


What do you understand by the term polymorphism?

718


What about interthread communication and how it takes place in java?

654


Why is boolean important?

690


What is square root in java?

678


What is a boolean expression in java?

626


What are checked exceptions?

675


Does every java program need a main?

622


Can a class be private or protected in java?

652