Java

2-Dimensional array in java.

Two dimensional array is nothing but set of many one-dimensional array which is represented in usually rows and columns but they are stored in the continuous memory location. The syntax of the 2-D array is

It allocates 4×5 int elements in an array which internally stores 80 bytes of memory(If one int takes 4 bytes of memory).
We can also assign the elements to an array dynamically and the syntax goes like this :

We can also allocate row with different columns and this type of an array is called as a jagged array.


Sample code goes here: