1.Math.random()
Math.random()生成随机数区间为 [ 0.0, 1.0 ) 左闭右开
2.switch case
int n = 2;
switch(n){
case 0:
System.out.println("zero");
break;
case 1:
System.out.println("one");
break;
case 2:
System.out.println("two");
break;
default:
System.out.println("other");
break;
}
//输出two
评论区