posted 14 years ago
Consider the case when your code throws some un-anticipated exceptions (e.g unchecked exceptions like NullPointerException) which are not explictly caught in the catch block.
In such a case, since the exception is not caught, the program will dump the trace and exit. However, if you have some cleanup to be done, you can do it in the finally block.
Infact, you can also have only try and finally blocks. e.g.