20. The return statement in the try block has no apparent effect if the finally block contains a return statement, or if an exception gets thrown in the finally block but not caught there. The following program produces no output other than Exception in thread "main" java.lang.RuntimeException at F.testMethod(F.java:11) at F.main(F.java:16)
finally gets executed no matter where the execution goes. in try or in catch before the function returns finally will be executed except in only one case that is when you type a System.exit() somewhere in try or catch or finally itself. this will kill the JVM and execution stops then and there.
Life called,so here I am.<br />Cheers<br />Niki.:-)
Thanks a lot vidya. I have understood the concept.
Its that the return statement in the try block will be evaluated but before returning the value it will execute the finally block and inside the finally block when it encounters the return statement it will return that value.