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
How to Sort Strings which are given in List and display in ascending order without using java api.
Explain about static imports in java?
What is a layout manager and what are different types of layout managers available in java awt?
What are the parts of a method?
What is complexity and its types?
What is the difference between actual and formal parameters?
Can we override constructors?
What is map in java?
Explain the use of sublass in a java program?
Explain about the dynamic behavior of core java?
Which method you will use to create a new file to store some log data. Each time a new log entry is necessary, write string to the file in java ?
What is main in java?
can used Protected Class outside Function.?
What’s the difference between callable and runnable?
What is class??