import java.util.Random;
public class RandomWithArray {
public static void main(String[] args){
Random r = new Random();
int[] num = new int[5]; //same as "= {0,0,0,0,0}
for (int i = 0; i <num.length; i++){
num[i] = r.nextInt(100) + 1;
}
System.out.println(num[i]);
}
}
Eclipse 告诉我,在打印线上,
Multiple markers at this line
- i cannot be resolved to a variable
- Line breakpoint:RandomWithArray [line: 14] -
main(String[])
我到底做错了什么?