forked from Labore/PR2-L
1
0
Fork 0
PR2-L/Seiteneffekt/src/Door.java

17 lines
417 B
Java

class SwingException extends Exception {}
class CloseException extends Exception {}
class Door implements AutoCloseable {
public void swing() throws Exception {
System.out.println("The door is becoming unhinged!");
close();
throw new SwingException();
}
public void close() throws Exception {
System.out.println("The door is now closed.");
throw new CloseException();
}
}