public class Test {
public static void main(String[] args) {
double random = Math.random();
int i = (int) (random * 4 + 1);
switch (i) {
case 1:
System.out.println("这次我是" + i);
break;
case 2:
System.out.println("这次我是" + i);
break;
case 3:
System.out.println("这次我是" + i);
break;
case 4:
System.out.println("这次我是" + i);
break;
}
}
}
public class Test {
public static void main(String[] args) {
int i = 1;
switch (i) {
case 0:
System.out.println("0");
case 1:
System.out.println("1");
case 2:
System.out.println("2");
case 3:
System.out.println("3");
break;
default:
System.out.println("default");
}
}
}