An array of objects, which is easily understood as: the elements in the array are all objects. but this understanding is wrong , the array is not the object itself, but the object's reference, that is, the pointer to the object, and this pointer is stored in the virtual machine memory stack.
Creating an array of objects requires two steps: 1) Create an array that holds references to objects. 2) Specify which object each reference points to (implemented in new). The following examples illustrate.
Suppose you have a class with a class name of test. 1) test[] array = new TEST[2]; Create an array named array with a total of 2 elements, each of which is a reference to the test object. The default initial value for Array[0] and array[1] at this time is null (no point to any object). 2) array[0] = new test (); array[1] = new test (), respectively, in the heap of virtual machine memory, two space to Test two objects, array[0] and array[1] respectively point to the first address of the two areas.