2-Dimensional array in java.

Two dimensional array is nothing but set of many one dimensional array which are represented in usually rows and columns but they are stored in continuous memory location.The syntax of 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 jagged array.

Sample code goes here:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Advertisment ad adsense adlogger