目录
switch
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
// to see how IntelliJ IDEA suggests fixing it.
for (int i = 1; i <= 19; i++) {
switch (i % 6) {
case 1 ->System.out.printf( "%d,1\n",i);
case 2 -> System.out.printf("%d,2\n",i);
case 3 -> System.out.printf("%d,3\n",i);
case 4,5 -> System.out.printf("%d,4,5\n",i);
}
}
}
}
1,1
2,2
3,3
4,4,5
5,4,5
7,1
8,2
9,3
10,4,5
11,4,5
13,1
14,2
15,3
16,4,5
17,4,5
19,1