<<< Jagged array of integers example | Index | Using foreach loops with a two-dimensional array >>> |
Code that prints the contents of the jagged array of integers
int[][] pyramid = new int[4][]; //... for (int i = 0; i < pyramid.length; i++) { for (int j = 0; j < pyramid[i].length; j++) { System.out.print(pyramid[i][j] + " "); } System.out.print("\n"); }
The console output
0 1 2 3 4 5 6 7 8 9
<<< Jagged array of integers example | Index | Using foreach loops with a two-dimensional array >>> |