Hello I am developing a mathematical library for java I wrote methods Matrix(), setMatrix (), getMatrix () is required to getmatrix() method returned the entire two-dimensional array more precisely all its values
static int[][] getMatrix(){//return matrix
return matrix;
}//why returns a reference instead of an array value ? [[I@15db9742 only this
class Mathematik {
private static int[][] matrix;
private static int line_0;
private static int column_0;
static int Matrix(int line, int column){//Matrix
for(int l=0; l<line; l++){//line
for(int j=0; j<column; j++){//column
line_0=l;
column_0=j;
matrix=new int[l][j];
}
}
return matrix;
}
static int setMatrix(int num){//fill matrix
for(int l=0; l<line_0; l++){//line
for(int j=0; j<column_0; j++){//column
matrix[l][j]=num;
}
}
return 0;
}
static int[][] getMatrix(){//return matrix
return matrix;
}//why returns a reference instead of an array value ? [[I@15db9742 only this
}
class Activity{
Mathematik A=new Mathematik();//call the class
public static void main(Strin[] args){
A.Matrix(3,3)//create matrix
A.setMatrix(10)//to fill in the matrix
System.out.println(""+A.getMatrix());//Writes the grid values to a string
}
}
arrays [1a, 2a, 3a.....a]
the method getMatrix() is required to return all values of the array
staticto declare fields.Matrixmethod? That should be created outside your nested loops. And I'm not certain what that method is supposed to do.