![]() |
|||
Query on Finally block:
By: Admin | 09 Mar 2010 12:05 pm
Hi, CommentsHi, As you stated in your question, the code inside the finally block with normally execute irrespective of what happens, whether an exception occurs or not. This area of code is therefore used for necessary activities such as closing of opened database connections and releasing of acquired resources. Without a finally block, an exception will bubble out of the application and go to the Catch block so that everything after the code that gave the exception will not be implemented. To ensure that a piece of code is always implemented whether or not an exception occur, you need the finally block. I hope this helps. Best regards,
By: Admin | 09 Mar 2010
Hi,
Many thanks for the reply.
I can close the database connection and release resources outside finally block which will anyway execute after execution of try catch block. Then why should I have finally block?
Thanks,
By: Admin | 09 Mar 2010
By: Admin | 09 Mar 2010
|
