Oracle
1Z0-851 · Question #180
1Z0-851 Question #180: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #180. The question stem and answer options stay visible for context.
Question
Given: 05. class A { 06. void foo() throws Exception { throw new Exception(); } 07. } 08. class SubB2 extends A { 09. void foo() { System.out.println("B "); } 10. } 11. class Tester { 12. public static void main(String[] args) { 13. A a = new SubB2(); 14. a.foo(); 15. } 16. } What is the result?
Options
- AB
- BB, followed by an Exception.
- CCompilation fails due to an error on line 9.
- DCompilation fails due to an error on line 14.
- EAn Exception is thrown with no other output.
Unlock 1Z0-851 to see the answer
You've previewed enough free 1Z0-851 questions. Unlock 1Z0-851 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.