0
我需要通过使用嵌套的while循环只填充用户输入的双数组。这是我到目前为止有:Java - 如何使用嵌套while循环填充2d数组?
public static double[][] score() {
int col = 3;
int row = 3;
int size = 0;
Scanner in = new Scanner(System.in);
double[][] scores = new double[row][col];
System.out.println("Enter your scores: ");
while (in.hasNextDouble() && size < scores.length) {
while (size < scores[size].length) {
scores[][] = in.hasNextDouble();
size++;
}
return scores;
}
你知道前手的数组的大小? – luckydog32
3行,3列,所以我需要9总输入。 – MetalGearRyan