Oracle
1Z0-851 · Question #42
1Z0-851 Question #42: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-851 to reveal the answer and full explanation for question #42. The question stem and answer options stay visible for context.
Question
Given: import java.io.IOException; class A { public void process() { System.out.print("A,"); } } 13. class B extends A { 14. public void process() throws IOException { 15. super.process(); 16. System.out.print("B,"); 17. throw new IOException(); 18. } 19. 20. public static void main(String[] args) { 21. try { 22. new B().process(); 23. } catch (IOException e) { 24. System.out.println("Exception"); 25. } 26. } 27.} What is the result?
Options
- AException
- BA,B,Exception
- CCompilation fails because of an error in line 20.
- DCompilation fails because of an error in line 14.
- EA NullPointerException is thrown at runtime.
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.