Is it possible to write a method that System.exit will call when you terminate a program?
Use Runtime.getRuntime().addShutdownHook(Thread)
.
Shutdown hooks are the answer... here is an article on them. They do not come without issues (some of them are discussed in the article).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With