Oracle
1Z0-809 · Question #111
1Z0-809 Question #111: Real Exam Question with Answer & Explanation
Sign in or unlock 1Z0-809 to reveal the answer and full explanation for question #111. The question stem and answer options stay visible for context.
Question
Given the class definitions:
class ImageScanner implements AutoCloseable {
public void close () throws Exception {
System.out.println ("Scanner closed.");
}
public void scanImage () throws Exception {
System.out.println ("Scan.");
throw new Exception ("Unable to scan.");
}
}
And:
class ImagePrinter implements AutoCloseable {
public void close () throws Exception {
System.out.println ("Printer closed.");
}
public void printImage () {System.out.print ("Print.");}
}
And this code fragment:
try (
ImageScanner ir = new ImageScanner();
ImagePrinter iw = new ImagePrinter() ) {
ir.scanImage();
iw.printImage();
} catch (Exception e) {
System.out.print (e.getMessage());
}
What is the result?Options
- AScan.Printer closed.Scanner closed.Unable to scan.
- BScan.Print.Unable to scan.Printer closed.Scanner closed.
- CScan.Print.Printer closed.Scanner closed.Unable to scan.
- DCompilation fails
Unlock 1Z0-809 to see the answer
You've previewed enough free 1Z0-809 questions. Unlock 1Z0-809 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.