Java Reference
In-Depth Information
public int getAge()
{
statements
}
J.2.4 For all other blocks, braces open at the end of a line
All other blocks open with braces at the end of the line that contains the keyword defining the
block. The closing brace is on a separate line, aligned under the keyword that defines the block.
For example:
while( condition ) {
statements
}
if( condition ) {
statements
}
else {
statements
}
J.2.5 Always use braces in control structures
Braces are used in if-statements and loops even if the body is only a single statement.
J.2.6 Use a space before the opening brace of a control structure's block
J.2.7 Use a space around operators
J.2.8 Use a blank line between methods (and constructors)
Use blank lines to separate logical blocks of code; this means at least between methods, but also
between logical parts within a method.
J.3 Documentation
J.3.1 Every class has a class comment at the top
The class comment contains at least:
a general description of the class
the author's name(s)
a version number
Every person who has contributed to the class has to be named as an author or has to be
otherwise appropriately credited.
Search WWH ::




Custom Search