I've started writing a class to model a matrix and the compiler gives me this message:
Matrix.java:4: cannot find symbol symbol : constructor Matrix(int[][]) location: class Matrix Matrix y = new Matrix(x);
This is the code that I was trying to compile:
public class Matrix<E> {
public static void main(String[] args) {
int[][] x = {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}, {1, 2, 3}};
Matrix y = new Matrix(x);
System.out.println(y.getRows());
System.out.println(y.getColumns());
}
private E[][] matrix;
public Matrix(E[][] matrix) {this.matrix = matrix;}
public E[][] getMatrix() {return matrix;}
public int getRows(){return matrix.length;}
public int getColumns(){return matrix[0].length;}
}
So, my question is, why am I getting this error, and what should I change to fix this?