Java-Programming-Docs Help

Arrays of Objects

Unlike an array of primitives, when you create an array of objects, they are not stored in the actual array. The array only stores references to the actual objects, and initially each reference is null unless explicitly initialized.

  • Below shows what an array of Objects elements would look like where the elements are as follows:

    • Leonardo da Vinci's country of birth, Italy

    • An image of his painting "The Baptism of Christ"

    • His theories (drawings) about helicopters and parachutes

    • An image of the "Mono Lisa"

    • His country of death, France

image_1.png

The stack and heap memory for an array of objects

Last modified: 16 July 2024