Im working on this code and expecting a matrix to be printed but thats what came up Matrix@2c78bc3b Matrix@2a8ddc4c
This is a code example:
public class Matrix { public static int rows; public static int colms;//columns public static int[][] numbers; public Matrix(int[][] numbers) { numbers = new int[rows][colms]; } public static boolean isSquareMatrix(Matrix m) { //rows = numbers.length; //colms = numbers[0].length; if(rows == colms) return true; else return false; } public static Matrix getTranspose(Matrix trans) { trans = new Matrix(numbers); for(int i =0; i < rows; i++) { for(int j = 0; j < colms; j++) { trans.numbers[i][j] = numbers[j][i]; } } return trans; } public static void main(String[] args) { int[][] m1 = new int[][]{{1,4}, {5,3}}; Matrix Mat = new Matrix(m1); System.out.print(Mat); System.out.print(getTranspose(Mat)); } }