Java   View all facts   Glossary   Help
syntactic unit > scoping unit > block > nested block > finally block
Next nested blockinitialization block    Upnested block    Previous nested blocktry block   

finally block
subjectfact 
finally blockhas purpose to clean up internal state or to release non-object resources, such as open files stored in local variables, whether or not an exception has occurred.added by: JK, source: Sun Java Tutorial, 2001-10-19 11:36:45.0
has syntax
// a try-catch-finally statement showing the finally block in bold
try{
statements
} catch (exception_type1 identifier1) {
statements
} catch (exception_type2 identifier2) {
statements
...
} finally {
statements
}
added by: JK, 2001-10-19 11:36:45.0
is part of try-catch-finally statementadded by: JK, 2001-10-19 11:36:45.0
is a subtopic of Exception Handling2001-10-19 11:36:45.0
is a kind of nested blockadded by: JK, 2001-10-19 11:36:45.0
nested blockshould be indented carefully2001-10-19 11:37:29.0
blockcontains several statements surrounded by braces    2001-10-19 11:36:10.0
has example
{
a =5;
b = computeSomething;
}   
2001-10-19 11:36:10.0
has layout example style preferred by Sun:
if(condition) {
// statements
}
2001-10-19 11:36:10.0
has layout example style preferred by the authors:
if(condition)
{
// statements
}
2001-10-19 11:36:10.0
is used as the body of classes, loops, conditional statements and for exception handling    2001-10-19 11:36:10.0
syntactic unithas syntax rule
bold = mandatory
italic = non-terminal
normal font = optional
2001-10-19 11:38:04.0