CONTENTS | PREV | NEXT | Java Code Conventions |
Blank lines improve readability by setting off sections of code that are logically related.Two blank lines should always be used in the following circumstances:
One blank line should always be used in the following circumstances:
- Between methods
- Between the local variables in a method and its first statement
- Before a block (see section 5.1.1) or single-line (see section 5.1.2) comment
- Between logical sections inside a method to improve readability
Blank spaces should be used in the following circumstances:
while (true) {
...
}
a += c + d;
a = (a + b) / (c * d);
while (d++ = s++) {
n++;
}
prints("size is " + foo + "\n");
for (expr1; expr2; expr3)
myMethod((byte) aNum, (Object) x);
myFunc((int) (cp + 5), ((int) (i + 3))
+ 1);