0
Why we cannot put' , ' after the bracket {2,3,4} and {2,3}?
int[][][] test = { { {1, -2, 3}, {2, 3, 4} }, { {-4, -5, 6, 9}, {1}, {2, 3} } }; // for..each loop to iterate through elements of 3d array for (int[][] array2D: test) { for (int[] array1D: array2D) { for(int item: array1D) { System.out.println(item); } } } } } But in 2D array, they put ',' before it end
2 Réponses
+ 2
Putting camma there means "still there another array left.
But for your, those are the last arrays {} so you should not put for last one...
+ 1
Ouhh I understand. Thanks!