Multi-Dimensional arrays are arrays whose elements are themselves arrays. The same as One-Dimensional arrays there are different ways of declaring them. Only one of these ways is the preferred way, but for the purpose of the exam you must know all the valid ways. Let’s see them with some examples:
1 2 3 4 5 6 7 8 9 10 11 |
// Declaring a 2-dimensional array int[][] array; // Preferred way int[] array[]; // Valid but discouraged // Declaring a 3-dimensional array int[][][] array; // Preferred way int[] array[][]; // Valid but discouraged int[][] array[]; // Valid but discouraged |
Once you ..Continue Reading