What is a Shutdown Hook in Java ?

The shutdown hook is a thread that is invoked implicitly by JVM just before the shut down. It can be used to clean up unused resources etc.

We can use java.lang.Runtime.addShutdownHook(Thread hook) method to register a new virtual-machine shutdown hook.



You May Interest

Why Do We Use Static Initializers in Java ?

How Will You Implement Error Page in JSP ?

What is the Reason For Overriding equals Method in Java ?

Enumeration and Iterator, Which One Has Better Performance in Jav ...

What are the Differences Between Collection and Collections in Ja ...