java initialize matrix code example
Example: instantiate matrix java
int[][] matrix1 = new int[2][2];
matrix1[0][0] = 1;
matrix1[0][1] = 2;
matrix1[1][0] = 3;
matrix1[1][1] = 4;
//or
int[][] matrix2 = {{1,2},{3,4}};
int[][] matrix1 = new int[2][2];
matrix1[0][0] = 1;
matrix1[0][1] = 2;
matrix1[1][0] = 3;
matrix1[1][1] = 4;
//or
int[][] matrix2 = {{1,2},{3,4}};