<<< jagged array | Index | Printing the jagged array of integers >>> |
Code that creates and initializes a jagged array of integers
int number = 0; int[][] pyramid = new int[4][]; for (int i = 0; i < pyramid.length; i++) { pyramid[i] = new int[i+1]; for (int j = 0; j < pyramid[i].length; j++) pyramid[i][j] = number++; }
<<< jagged array | Index | Printing the jagged array of integers >>> |