形如学号是20200101的同学的年龄是:18(年龄在18,19中随机产生)
public static void main(String[] args) {
for (int i = 1; i <= 20; i++) {
System.out.println("学号:" + i + " 年龄:" + (new Random().nextInt(2) + 18));
}
}
for循环1~20 循环体输出 new Random(). nextInt(2)+18 表示范围18~18+2 -1