+ 2

Is it possible to print a 2-D array using enhanced for loop in java?

11th Jun 2020, 11:53 AM
Dipesh Das
Dipesh Das - avatar
2 Réponses
+ 3
int[][] array = {{1,2,3},{4,5,6},{7,8,9}}; for (int[] row : array) for (int num : row) System.out.println(num);
11th Jun 2020, 1:30 PM
zemiak