Java / Exception
How are the exceptions handled in java?
When an exception occurs, the execution of the program is aborted and handed over to an appropriate exception handler. The try-catch-finally block is used to handle the exception.
The code in which the exception may occur is enclosed in a try block ,also called as guarded region.
The catch clause matches a specific exception to a block of code which handles that exception.
The finally block executes even no exception occurs and usually hold clean up code such are closing database connection, file etc.
More Related questions...