An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.
When a exception occurs , the system searches for a block of code called "Exception Handler" in the call stack.
Call Stack is nothing but the list of methods that had been called to the method where the exception occured.
The system searches for the appropriate method in the call stack in the reverse order . If the appropriate method is found , the exceptions are handled , else the system terminates.
The block of code that is expected to throw some exception is written in
try.....catch....finally block.
No comments:
Post a Comment