How are try, catch and finally block organized? The try block is the region of code where exceptions can get produced. So most of the code of execution lies in this region.
The catch block is where an Exception is caught. Then, the action to be performed upon catching the exception is stated in this block. Usually a user friendly message is displayed.
The finally block is the region where the code that needs to be executed under any circumstance is written. This is usually performing a clean up. 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).