I am having some trouble returning matrix data from one method to the main class, I am using:
matrix = setFalse(falseMatrix);
to call:
public static boolean[][] setFalse (boolean[][] matrix[][]) {
// Changes each value of the matrix to a false boolean value
boolean[][] falseMatrix = null;
for (int r = 0; r < matrix.length; r++ ) {
for (int c = 0; c < matrix[0].length; c++ ) {
falseMatrix[r][c] = false;
}
}
return falseMatrix;
}
I am getting the error that falseMatrix cannot be resolved to a variable, but when I make it a parameter I get a fatal error.
Your code is currently very confused. I suspect you want:
How you then call the method is a different matter. You need to already have a variable (or some other expression) of type
boolean[][]. Unfortunately you haven’t shown us any of the context of the calling code.