if all the try and catch statements have return blocks the finally is unreachable.
I tested this code segment.
The
finally block executes just before the
return statement whether or not the exception is thrown.
The compiler error occurs because the last
return statement, after the
finally block, is never executed.
The reason the second code segment does compile is that the
return statement was removed from the
try block, so there is a way to execute the statement after the
finally block.
[ November 28, 2004: Message edited by: Mike Gershman ]