This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
The most popular example is a database connection. The finally block WILL run even if there are tons of exceptions happening in your try block. Since you want to close your database connection cleanly, this is to be done in the finally block, whether there have exceptions been raised or not.
JDBCSupport - An easy to use, light-weight JDBC framework -
Key benefits of using finally have already listed.
Suppose you have a code
Now, many times the catch block re throw an exception and goes out of the current function. In that case the function "funcMustExecute" will not execute. In order to ensure that you function get execute you should write it in the finally block.
Hope it helps.