How can I call a method in the main method ?
public class Sum extends ConsoleProgram {
public void run() {
int[][] array = {{32, 4, 14, 65, 23, 6},
{4, 2, 53, 31, 765, 34},
{64235, 23, 522, 124, 42}};
}
public static int sumRow(int[][] array, int row) {
int sum = 0;
for(int col = 0; col < array[row].length; col++) {
sum += array[row][col];
}
return sum;
}
}
I used this option
public void run() {
int[][] array = {{32, 4, 14, 65, 23, 6},
{4, 2, 53, 31, 765, 34},
{64235, 23, 522, 124, 42}};
sumRow(); // and this way System.out.println(sumRow);
}
Expected result:
144
889
64946⏎
Actual result:
You forgot to print something.