Finally block is meant for cleanup.. and there is a rare possiblity of getting an exception there.. many cases it can be ignored.
If required we can handle that exception.. the similar way of putting that code inside the try/block.
If we are ignoring the exception inside the finally block, it is better to atleast log the stack trace.
Joined: Dec 10, 2009
thanks for your update but if we have any exception in finally block how the exception will catch as the finally block is hte last executer for that thread....
you will put the statement causing exception in try/catch block inside the finally block that is you will handle the exception normally as you do with exception outside the finally only thing is you are catching it within the finally block.