Java Programming
About Lesson

Multi-Dimensional Array

Array with single dimension can store a row of many data elements.  Each data element of single dimensional array can be considered as a field or column.  But an array may have many rows of data.  Such arrays can be useful to store tabular format of data.  This type of arrays known as two dimensional arrays. 

It is also possible an array is three dimensional, four dimensional or even n-dimensional.  But it becomes complex for developer to manage the data.

Example syntaxes of multi-dimensional arrays:

Two dimensional array:

int[][] Ar2D = new int[10][20];

Three dimensional array:

int[][][] Ar3D = new int[10][20][30];

The number of elements of a multi-dimensional array can be calculated by multiplying all dimensions.

The tabular format of element representation of a Two Dimensional Array:

Arr [3][5]

[0,0]

[0,1]

[0,2]

[0,3]

[0,4]

[1,0]

[1,1]

[1,2]

[1,3]

[1,4]

[2,0]

[2,1]

[2,2]

[2,3]

[2,4]

You cannot copy content of this page