I'm trying to initialize a 2d array using the braces notation as follows:
int[][] matrix = {{0, 2, 1}, {1, 2, 3}, {3, 2, 1}};
int[][] out = rotate(matrix);
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
System.out.print(matrix[i][j] + " ");
}
System.out.println("");
}
For the output, I am getting
0 0 0
0 0 0
0 0 0
Can someone tell me the problem?