The finally keyword is used to define a block that is always executed in a try−catch−finally statement.
A finally block typically contains cleanup code that recovers from partial execution of a try block.
Examples
try
{
<block that may throw exceptions>
}
catch (<java.lang.Exception or subclass> e)
{
<code to handle exception e>
}
finally
{
<statements that execute with or without exception>
}
Comments
Post a Comment