What is the purpose of the finally clause of a try-catch-finally statement? The finally block is the region where the code that needs to be executed under any circumstance is written. The purpose of this block is usually performing the clean up activities.
Eg: freeing the resources, etc. If the finally clause executes a return statement, it overrides a thrown exception (so the exception will not be thrown; instead the return will occur).
|