|
http://www.jindent.com |
Previous: Braces/Parentheses Insertion
|
Next: Empty Statements/Declarations
|
| Single if statement in one line |

if statements which just contain a single statement instead
a block body.if statement in one line:
|
if (a < 10) callMethod(a); |
if statement in one line:
|
if (a < 10) callMethod(a); |
| Single else statement in one line |

else part of if-else statements which just contain
a single statement instead a block body.else statement in one line:
|
if (a < 10) callMethod(a) else callOtherMethod(a); |
else statement in one line:
|
if (a < 10) callMethod(a) else callOtherMethod(a); |
if and else statement in one line:
|
if (a < 10) callMethod(a) else callOtherMethod(a); |
| Treat else and if as one else/if statement |

else and if statements are put together as one statement or not.else and if statements as one statement:
|
if (a < 10) { System.out.println("a"); } else if (b < 10) { System.out.println("b"); } else if (c < 10) { System.out.println("c"); } else System.out.println("none"); |
else if treatment:
|
if (a < 10) { System.out.println("a"); } else if (b < 10) { System.out.println("b"); } else if (c < 10) { System.out.println("c"); } else System.out.println("none"); |