Oracle
1Z0-851 · Question #51
Given: 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…
The correct answer is A. B. See the full explanation below for the reasoning.
Question
Given: 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?
Options
- AB
- BThe code runs with no output.
- CCompilation fails because of an error in line 12.
- DCompilation fails because of an error in line 15.
- ECompilation fails because of an error in line 18.
How the community answered
(39 responses)- A69% (27)
- B3% (1)
- C15% (6)
- D5% (2)
- E8% (3)
Community Discussion
No community discussion yet for this question.