My goal is to print out the Matrix when the two arrays are multiplied together. What am I doing wrong with this code? How do I get it so that it prints out the matrix? (Sorry I do not know what other details i should provide and I cannot submit this post unless I add more detail).
public class Matrices {
static int mRows = 0;
static int mCol = 0;
static int nRows = 0;
static int nCol = 0;
 public static int[][] multiplyMatrices(int[][] m, int[][] n){
    mRows = m.length;
    mCol = m[0].length;
    nRows = n.length;
    nCol = n[0].length;
    if(canBeMultiplied(m,n) == false){
        throw new IllegalArgumentException("Cannot multiply arrays");
    }
    int[][] answer = new int[mRows][nCol];
    for(int i = 0; i < mRows; i++){
        for(int j = 0; j < nCol; j++){
            for(int k = 0; k < mCol; k++){
                answer[i][j] += m[i][k] * n[k][j];
            }
        }
    }
    return answer;
}
public static boolean canBeMultiplied(int[][] m, int[][]n){
    mRows = m.length;
    mCol = m[0].length;
    nRows = n.length;
    nCol = n[0].length;
    if(nRows == mCol){
        return true;
    }
    return false;
}
public static void main(String[] args) {
    int[][] temp1 = {{1,2,3},{4,5,6}};
    int[][] temp2 ={{1},{2},{3}};
    for(int i = 0; i < mRows; i++){
        for(int j = 0; j < nCol; j++){
            System.out.print(multiplyMatrices(temp1,temp2)[i][j]);
        }
                    System.out.print("\n");
    }
}
}
Thanks for your help.
 
    