|
http://www.jindent.com |
Previous: JavaDocs
|
Next: Switch-Case Blocks
|
| Blank lines before statements containing blocks |

|
a = callMethod(); a++; ¶ if (a < 10) { ... } |
|
a = callMethod(); a++; if (a < 10) { ... } |
|
public void method() { do { ... } while(x < n); ¶ a = callMethod(); a++; ¶ if (a < 10) { ... } ¶ callOtherMethod(); } |
| Blank lines after statements containing blocks |

|
do { ... } while(x < n); ¶ a = callMethod(); a++; |
|
do { ... } while(x < n); a = callMethod(); a++; |
|
public void method() { do { ... } while(x < n); ¶ a = callMethod(); a++; ¶ if (a < 10) { ... } ¶ callOtherMethod(); } |
| Insert blank lines between different statement types |

|
public void main() { System.out.println("Hello World !"); // method call callMethod(); // method call a = getSomething(); // assingment b = a + 1; // assingment callAnotherMethod(a, b); // method call callEvenMoreMethods(); // method call a++; // expression ... } |
|
public void main() { System.out.println("Hello World !"); // method call callMethod(); // method call ¶ a = getSomething(); // assingment b = a + 1; // assingment ¶ callAnotherMethod(a, b); // method call callEvenMoreMethods(); // method call ¶ a++; // expression ... } |
| Blank lines before break statement |

break statements.|
switch(value) { case 1: x = x + 10; y = x / 2; ¶ break; ¶ ... } |
|
switch(value) { case 1: x = x + 10; y = x / 2; break; ¶ ... } |
| Blank lines before continue statement |

continue statements.|
if ( condition ) { x = x + 10; y = y / 2; ¶ continue; } |
|
if ( condition ) { x = x + 10; y = y / 2; continue; } |
| Blank lines before return statement |

return statements.|
public int getA() { int x = callMethod(); x = x + 10; ¶ return x; } |
|
public int getA() { int x = callMethod(); x = x + 10; return x; } |
| Blank lines before throw statement |

throw statements.|
if ( x == null ) { text = createErrorText(); ¶ throw new MyException(text); } |
|
if ( x == null ) { text = createErrorText(); throw new MyException(text); } |