Java finally

Ads
 

Java finally

In java, there are three clauses named try, catch and finally used as exception handler components

In java, there are three clauses named try, catch and finally used as exception handler components

Java finally

     

 

In java, there are three clauses named try, catch and finally used as exception handler components. If the section enclosed within the try block generates any exception then catch block acts as an exception handler. But it is always a good practice to use finally clause after the try and catch block to handle an unexpected exception occurred in the try block. It becomes possible because the finally block always executes when the try block exits and it is also useful to write the cleanup code within the finally block because it will be executed surely whether the exception is generated or not.

Read more at:

http:/www.roseindia.net/java/exceptions/catching-and-handling-exceptions.shtml

 

Ads

Ads