9.1 Declaring and Instantiating Multidimensional Arrays

Just like single-dimensional arrays, multidimensional arrays are implemented as objects, so creating a multidimensional array takes the same two steps as creating a single-dimensional array:

  1. declaring the object reference for the array

  2. instantiating the array

In arrays with elements of primitive types, each element of the array contains a value of that type. For example, in an array of doubles, each element contains a double value. In arrays with a class data type, each element is an object reference, which points to the location of an object of that class.

9.1.1 Declaring Multidimensional Arrays

To declare a multidimensional array, we use the same syntax as for a single-dimensional ...

Get Java Illuminated, 5th Edition now with O’Reilly online learning.

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