| 1 | package example; |
| 2 | |
| 3 | import java.util.List; |
| 4 | |
| 5 | public class Example { |
| 6 | private int value; |
| 7 | |
| 8 | public Example(int value) { |
| 9 | this.value = value; |
| 10 | } |
| 11 | |
| 12 | public int compute(int a, int b) { |
| 13 | int[] numbers = { |
| 14 | 1, |
| 15 | 2, |
| 16 | 3, |
| 17 | }; |
| 18 | for (int i = 0; i < numbers.length; i++) { |
| 19 | if (numbers[i] > a) { |
| 20 | System.out.println(numbers[i]); |
| 21 | } else { |
| 22 | a += numbers[i]; |
| 23 | } |
| 24 | } |
| 25 | while (a > 0) |
| 26 | a--; |
| 27 | if (a > 5) |
| 28 | a -= 5; |
| 29 | for (int i = 0; i < b; i++) |
| 30 | a += i; |
| 31 | switch (b) { |
| 32 | case 1: |
| 33 | return a; |
| 34 | case 2: |
| 35 | return b; |
| 36 | default: |
| 37 | return 0; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | String textBlock() { |
| 42 | return """ |
| 43 | unindented |
| 44 | indented |
| 45 | """; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | class Braceless { |
| 50 | void m(boolean cond) { |
| 51 | if (cond) |
| 52 | doThing(); |
| 53 | else |
| 54 | other(); |
| 55 | } |
| 56 | } |