謝謝您的幫助。但這個網站是荒謬的。對不起,如果你不喜歡我的問題。我無處可去!我需要一只手,有人很友好地提供幫助。但是,其他人對我的問題投了反對票,現在我無法再問一個問題,并且可能會從網站上啟動。我還能從哪里尋求幫助?我要去的學校沒有這個專案的導師,我的老師在需要一些指導時真的沒有幫助。
公共類 SumOfColumns {
public static int sumColumn(int[][] m, int columnIndex) {
for (int column = 0; column < 4; column ) {
columnIndex = 0;
for (int row = 0; row < 3; row ) {
columnIndex = m[column][row];
}
}
return columnIndex;
}
public static void main(String[] args) {
***int[][] grid = fillArray();***
}
public static int[][] fillArray(int[][] userInput) {
Scanner input = new Scanner(System.in);
int[][] grid = new int[3][4];
System.out.println("Enter a 3x4 grid of numbers please: ");
for (int row = 0; row < grid.length; row ) {
for (int column = 0; column < grid[row].length; column ) {
grid[row][column] = input.nextInt();
}
}
return grid;
}
}
uj5u.com熱心網友回復:
當你宣告你的fillArray函式時,你給了它一個輸入int[][] userInput,但是當你呼叫時:
int[][] grid = fillArray();
你不給fillArray和輸入int[][]。如果您從fillArray應該修復它的函式中洗掉引數。它看起來像:
public static int[][] fillArray() {
// your code...
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/342699.html
