(OCP) Oracle Certified Professional Practice Test

โ–ถ

OCP Exception Handling and Assertions Questions and Answers 1

Free ยท Instant Results

Examine the following code which uses a try-with-resources statement. What is the output when this code is executed? ```java class Door implements AutoCloseable { private String name; public Door(String name) { this.name = name; System.out.println(name + " opened"); } @Override public void close() { System.out.println(name + " closed"); } } public class Test { public static void main(String[] args) { try (Door front = new Door("Front"); Door back = new Door("Back")) { System.out.println("Walking through doors"); } } } ```
โ–ถ Start Practice Test