CSCI03: Handling Exceptions and Events
CSCI03: Handling Exceptions and Events
EXCEPTION
Occurrence of an undesirable situation that can be detected during program execution. Example:
Division by zero Entering invalid data
If exceptions occurred during the program execution, the program terminated with an appropriate error message.
Sample Run 2
catch block
Specifies the type of exceptions it can catch and contains an exception handler. A java program can have more than one catch block and can either be followed by a finally block.
finally block
It is always being executed whether or not an exception occur.
Sample Run 2
Sample Run 3