What is ShutDownHook?
Shutdown Hooks are a special construct that allow developers to plug in a piece of code to be executed when the JVM is shutting down.
We can achieve it by overriding the checkExit method of SecurityManager class.
Now uncomment the line 10 i.e throw new SecurityException().
The new output will be: