finally
Keyword
finally
statement lets you execute code, after try
...catch
, regardless of the result.
A finally
block typically contains cleanup code that recovers from partial execution of a try
block.
It is always a good practice to use finally
clause after the try
and catch
block to handle an unexpected exception occurred in the try
block.
The finally
block always executes when the try
block exits and it is also useful to write the cleanup code within the finally
block.
I feel bad for the homeless guy, but I feel really bad for the homeless guy’s dog, because he must be thinking “Man, this is the longest walk ever.” |