A finally clause typically contains code to release resources acquired in its corresponding try block,this is an effective way to eliminate leaks.
Java gurantees that finally clause (if one is present following a try/catch sequence) will execute whether or not an exception is thrown in the corresponding try block or any of its corresponding catch clauses.
Hello my brother! I learned this today too! Analyze these two:
Now as you can see, we've lost, ONE line of code! I know, I know, thank you Java & C# for throwing in finally as a keyword, you have saved us. Not only finally! But goto as well! [ August 02, 2004: Message edited by: Jack Kay ]
I want 2 know y do v use finally block in exception handling when the statements after the try catch block can b executed without a finally block n irrespective of a exception. thanks Smyle
Let's try to translate this into English... y == why v == you ??? b == be n == ???
and then there's the little area of punctuation which comes in really handy when writing in other languages from Latin where it was considered to be more or less optional and often not used to control the flow of the sentence leading to phrases that are difficult if not impossible for the reader to properly comprehend without rereading multiple times.