|
http://www.jindent.com |
Previous: Presets
|
Next: If-Else Statements
|
if-else
statements).| For statements |

for statements which just contain of a single statement instead
of a whole block:
|
for (int i = 0; i < n; i++) System.out.println(i); |
|
for (int i = 0; i < n; i++) { System.out.println(i); } |
| While statements |

while statements which just contain of a single statement instead
of a whole block:
|
while (++i < n) System.out.println(i); |
|
while (++i < n) { System.out.println(i); } |
| Do-while statements |

do-while statements which just contain of a single statement instead
of a whole block:
|
do System.out.println(i); while (++i < n) |
|
do { System.out.println(i); } while (++i < n); |
| If-else statements |

if-else statements which just contain of a single statement instead
of a whole block:
|
if (i == 0) callMethodA(); if (i < n) System.out.println(i); else System.out.println(n); |
|
if (i == 0) { callMethodA(); } if (i < n) { System.out.println(i); } else { System.out.println(n); } |
| Conditions |

|
int x = a < 100 ? 1 : 0; if (x == 0 || 1000 > a && a > 10) { System.out.println(a); } |
|
int x = (a < 100) ? 1 : 0; if ((x == 0) || ((1000 > a) && (a > 10))) { System.out.println(a); } |