
An array’s data type can be
any primitive type or any
predefined or user-defined
class.The important thing
to remember is that each
element of an array with a
class data type is a refer-
ence to the object;it is not
the object itself.
SOFTWARE
ENGINEERING TIP
8.1 Declaring and Instantiating Arrays 465
8.1 Declaring and Instantiating Arrays
In Java, arrays are implemented as objects, so creating an array takes two steps:
1. Declaring the object reference for the array.
2. Instantiating the array.
In arrays of primitive types, each element in the array contains a value of
that type. For example, in an array of doubles, each element contains a dou-
ble value. I ...