This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
please consider it this way whenever there is an exit from the try block the finally will be executed. I dont think so there is any mearging. it simple as JVM encounters a statement or end brace that says "Get out from my try block", the JVM will always execute the finally block. its like when you tell a person to leave your house, he will prefer packing up his luggage before leaving. its just the same before leaving the try block the control packs the luggage i mean the finally block is executed
finally is used when you need to execute something that should be executed at all times invariable to what happens in try block. refrain from creating such codes as you illustrated
Joined: Jan 29, 2009
I agree that we should not write such code but am curious to know the reason as I was asked this question in one of the technical discussion that I had and I tried to reason out the same but the interviewer was curious to know some particular response which I am not sure what.
so thought of posting this question.