JAVATM- The Beginnings
Java supports arrays of object references as well as arrays of primitive types. While arrays of primitive types store values directly inside the array, arrays of object references point to objects which are located outside the array.
Figure 1 - Array of Object References versus Array of Primitives
Arrays of object references are declared the same as arrays of primitive types. However, declaring an array of object references does not create objects. It only defines a set of references which are initialized to null. Objects must still be created using the new operator.
Let’s create an array of Person object references using the Person class defined in Listing 1.
Listing 1 - Person.java
public class Person
private String name;
Copyright ©2017 by Ralph Lecessi Incorporated. All rights reserved.