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

How Will You Sort Objects by Natural Order in a Java List ?

What is a Directive in JSP ?

What are the Java Collection Classes That Implement List Interfac ...

What are the Differences Between a Vector and an ArrayList in Jav ...

How Will You Define the Scope of a Bean in Spring ?