Please go through the following code snippet:-
If finally has a return statement then the exception is not being propagated, why is it so? Comment the finally block or just the return statement in the finally block. The code complies and runs showing the exception thrown. But if the above code is run with return in finally, it is like eating away the exception. Can any one explain this? please correct me if I am wrong.
[Edit: Put code between [code] and [/code] UBB Code tags. Didn't really help though ]
Using the return statement in the finally block is usually not done. You cannot return and throw an exception at the same time so I guess the JVM chose to do what you wanted it to in the finally block.