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");
}
}
}
```
-
A
Front opened
Back opened
Walking through doors
Front closed
Back closed
-
B
Front opened
Back opened
Walking through doors
Back closed
Front closed
-
C
Front opened
Walking through doors
Front closed
Back opened
Back closed
-
D
The code will not compile because multiple resources are declared.