4.3. Arrays

[4.1] Declare, instantiate, initialize, and use a one-dimensional array

[4.2] Declare, instantiate, initialize, and use a multidimensional array

In this section, I’ll cover declaration, allocation, and initialization of one-dimensional and multidimensional arrays. You’ll learn about the differences between arrays of primitive data types and arrays of objects.

4.3.1. What is an array?

An array is an object that stores a collection of values. The fact that an array itself is an object is often overlooked. I’ll reiterate: an array is an object itself; it stores references to the data it stores. Arrays can store two types of data:

  • A collection of primitive data types
  • A collection of objects

Get OCA Java SE 8 Programmer I Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.