KnowledgeBoat Logo
LoginJOIN NOW

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:

How are the 2-D arrays stored in the memory? Arrays, Sumita Arora Computer Applications Solutions ICSE Class 10

Answered By

1 Like


Related Questions