Oracle
1Z0-805 · Question #3
1Z0-805 Question #3: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-805 to reveal the answer and full explanation for question #3. The question stem and answer options stay visible for context.
Question
Given: public class SampleClass { public static void main(String[] args) { SampleClass sc = new SampleClass(); sc.processCD(); } Oracle 1Z0-805 Exam private void processCD() { try (CDStream cd = new CDStream()) { cd.open(); cd.read(); cd.write("lullaby"); cd.close(); } catch (Exception e) { System.out.println("Exception thrown"); } } class CDStream { String cdContents = null; public void open() { cdContents = "CD Contents"; System.out.println("Opened CD stream"); } public String read() throws Exception { throw new Exception("read error"); } public void write(String str) { System.out.println("CD str is: " + str); } public void close() { cdContents = null; } What is the result?
Options
- ACompilation CD stream
- BOpened CD thrown
- CException thrown
- DOpened CD stream
- ECD str is: lullaby
Unlock 1Z0-805 to see the answer
You've previewed enough free 1Z0-805 questions. Unlock 1Z0-805 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.