public static int loadMat(int [][] mat) throws Exception{ int size, row, col = 0, num; Scanner input = new Scanner(System.in); System.out.print("Enter the size of the square : "); size = input.nextInt(); mat = new int [size][size]; System.out.println(); System.out.println("Enter the value for"); for (row = 0 ; row < size ; row++){ for (col = 0 ; col < size ; col++){ System.out.print("ROW " + row +" COL " +col +" : "); num = input.nextInt(); mat[row][col] = num; } } return size; } public static void printMat(int [][] mat, int size){ for (int i = 0 ; i < size ; i++){ System.out.print("ROW " + i +" "); for (int j = 0 ;j < size; j++){ System.out.print(size); } } } public static void main(String[] args) throws Exception{ int [][] themat = new int [10][10]; int thesize; int magicnum; boolean row,col,diag; thesize = loadMat(themat); printMat(themat, thesize); } }
so far i have that done...
which prompts the user to fill in the matrix... what i dont get is in the method printMat
how can i get a hold of the numbers the user just entered for the matrix?