Java Catch Stop Signal

Runtime.getRuntime().addShutdownHook(new Thread(() -> System.out.println("Game over")));
Im_Arxus