Oracle
1Z0-851 · Question #114
1Z0-851 Question #114: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #114. The question stem and answer options stay visible for context.
Question
Given: 11. class X { public void foo() { System.out.print("X "); } } 12. 13. public class SubB extends X { 14. public void foo() throws RuntimeException { 15. super.foo(); 16. if (true) throw new RuntimeException(); 17. System.out.print("B "); 18. } 19. public static void main(String[] args) { 20. new SubB().foo(); 21. } 22. } What is the result?
Options
- AX, followed by an Exception.
- BNo output, and an Exception is thrown.
- CCompilation fails due to an error on line 14.
- DCompilation fails due to an error on line 16.
- ECompilation fails due to an error on line 17.
- FX, followed by an Exception, followed by B.
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.