Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ShutDownHookExample {
public static void main(String[] args) {
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
System.out.println("Shutdown hook is running.");
}
});
System.out.println("Application terminating.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment