public class Array01 {
public static void main(String[] args) {
Random r = new Random();
int[] arr = new int[6]; //注意格式
int sum = 0;
for (int x = 0; x < arr.length; x++) {
int b = r.nextInt(100);
arr[x] = b; //完成随机数生成并填充数组
}
for (int x = 0; x < arr.length; x++) {
sum += arr[x]; //在完成的数组中进行求和
}
System.out.println("数组中随机数的和为:" + sum);
}
}