<<< Printing the jagged array of integers | Index | >>> |
Code that uses nested foreach loops to print a jagged array
int[][] pyramid = new int[4][]; //... for (int[] row : pyramid) { for (int col : row) { System.out.print(col + " "); } System.out.print("\n"); }
The console output
0 1 2 3 4 5 6 7 8 9
<<< Printing the jagged array of integers | Index | >>> |