Exception Handling Part2
Now we are going to continue from last post:
Inside a method if any exception occured the method in which it is raised is responsible to create exception object by including the following information
1. Name of exception
2. Description of exception
3. Location at which exception occurs(stack trace)
After creating exception object, method handovers that object to the jvm.
JVM will check wether the method contains an exception handling code or not. if the method doesnot contain exception handling code then, JVM terminates that method abnormally and removes crossponding entry from the stack.
Then JVM identifies caller methods and checks wether caller method contains any Exception handling code or not. If the caller method doesnot contain any handling code then JVM terminates tthat caller methods also abnormally and removes the crossponding entery from the stack
This process will be continued until main method, if the main() also doesnt contain handling code the JVM will terminates main() abnormally and removes crossponding entry from the stack also.
Then JVM handovers responsibility of exception handling to DefaultExceptionHandler, which is the part of JVM. DefaultExecptionHandler prints exception information in the following formate and terminates program abnormally.