Quiz · Exceptions · lesson 11 of 12
Quiz — the order resources close
What does the program print?
public class Main {
public static void main(String[] args) {
try (Door a = new Door("A"); Door b = new Door("B")) {
System.out.print(a.name() + b.name() + " ");
}
}
}
record Door(String name) implements AutoCloseable {
public void close() { System.out.print(name); }
}