Arrays of Arrays

We'll discuss how the terminology of arrays is not universally consistent among all programming languages. Java uses the terminology consistently, though. Then we'll show how to declare arrays of arrays in Java.

Array terminology

The language specification says there are no multidimensional arrays in Java, meaning the language doesn't use the convention of Pascal or Ada to put several indexes into one set of subscript brackets. Ada allows multidimensional arrays like this:

year : array(1..12, 1..31) of real;          Ada code for                                       multidimensional array. year(i,j) = 924.4;

Ada also allows arrays of arrays, like this:

type month is array(1..31) of real;          Ada code for array ...

Get Just Java™ 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.