I have a problem to understand array 2D looping concept. This is my code :
int[][] matA = new int[2][3];
matA[0][0] = 2;
matA[0][2] = 3;
matA[1][1] = -4;
for (int i = 0; i < matA.length; i++){
for (int j = 0; j < matA[0].length; j++){
System.out.print("\t" + matA[i][j]);
}
System.out.println("");
}
I know that matA[0].length
used for displaying what is second array or [3]
contain, I just don't understand how [0]
on metA[0].length
can displaying the second array