Java Multi-Dimensional1 min read

Declaring an array of arrays is known as Multidimensional Array or Jagged Arrays. In simple words, it is an array of arrays. It is created by appending a square brackets “[]” for each dimension. Here data are stored in a tabular form that is in row-major order as shown in an example below.

Syntax:

Declaration:

Instantiate Multidimensional Array in Java:

Array initialization:

We can also declare and initialize the 2D array together:


Example of a Multi-dimensional array in Java:

The output of Multi-dimensional:


One dimension array.