When ever exception occurs in a program , the method in which the exception occurred will inform the jvm about the exception and the jvm will create the object of exception with its name description and stack trace or location.
Then the jvm looks for the exception handling code in that method whether the exception is handled or not through try-catch block or throws clause. If it is handled then the program executes .
In the other hand if not handled the jvm terminates the method and looks for the caller method whether the handling is done over there or not if not it will be also terminated until it reaches to main().
If found main() has not provided the exception handling code the jvm handovers the object of exception to the default exception handler which is responsible to print the details of exception occurred by default it uses a method called printStackTrace. so we get messages for exception name its description and location. And finally the Jvm terminates the main() .
Then the jvm looks for the exception handling code in that method whether the exception is handled or not through try-catch block or throws clause. If it is handled then the program executes .
In the other hand if not handled the jvm terminates the method and looks for the caller method whether the handling is done over there or not if not it will be also terminated until it reaches to main().
If found main() has not provided the exception handling code the jvm handovers the object of exception to the default exception handler which is responsible to print the details of exception occurred by default it uses a method called printStackTrace. so we get messages for exception name its description and location. And finally the Jvm terminates the main() .