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