Computer Applications
How are the 2-D arrays stored in the memory?
Java Arrays
1 Like
Answer
Two-dimensional arrays are stored in a row-column matrix, where the first index indicates the row and the second indicates the column.
For example, if we declare an array pay
as follows:
short[][] pay = new short[5][7];
it will be having 5 x 7 = 35 elements which will be represented in memory as shown below:

Answered By
1 Like
Related Questions
For a multidimensional short array X[5][24], find the number of bytes required.
For a multidimensional array B[9][15] find the total number of elements in B.
What are the preconditions for Binary Search to be performed on a single dimensional array ?
A binary search of an ordered set of elements in an array is always faster than a sequential search of the elements. True or False ?