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

initialization block
subjectfact 
initialization blockhas purpose to be executed before any method for a class or instanceadded by: DS, 2001-10-19 11:36:55.0
is a subtopic of Classes2001-10-19 11:36:55.0
is a kind of nested blockadded by: DS, 2001-10-19 11:36:55.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

Kinds of initialization block :