Given:
class ImageScanner implements AutoCloseable {
public void close () throws Exception {
System.out.print ("Scanner closed.");
}
public void scanImage () throws Exception {
System.out.print ("Scan.");
throw new Exception("Unable to scan.");
}
}
class ImagePrinter implements AutoCloseable {
public void close () throws Exception {
System.out.print ("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?
Innovation
Highly Voted 4 years, 6 months agoasdfjhfgjuaDCV
Most Recent 4 months, 4 weeks agosteefaand
5 months, 4 weeks agor1muka5
1 year, 5 months agoWilsonKKerll
2 years, 4 months agoadnano1234
4 years, 6 months agoDestroyer
4 years, 7 months ago