Introduction.  Arrays have been a topic of importance in every programming language I have ever learned.  Usually, arrays are a collection of items or elements of a common data type that are referenced by a common name, but gain unique identification with numbers.

For example,

FirstName[1] = Slim

FirstName[2] = Thad

FirstName[3] = Chester

and so on

The overall array has a name called FirstName.  Each of its elements are

  • strings
  • uniquely identified by the number/index associated with the array name

Other possibilities exist, such as

Planet[1] = Mercury

Planet[2] = Venus

Planet[3] = Earth

and so on

Planet[9] = Pluto

In this instance the numberings correspond to the planet's average distance from the Sun.

As you might expect there are reasons to have higher dimensional arrays such as the following.


Orb[1,1] = Mercury    
Orb[2,1] = Venus    
Orb[3,1] = Earth Orb[3,2] = Moon  
Orb[4,1] = Mars Orb[4,2] = Phobos Orb[4,2] = Deimos
Orb[5,1] = Jupiter sixteen moons  


My understanding is that Jupiter is considered to have 16 moons, which I am not going to list out.

Now if you also consider artificial satellites such as those launched by people on Earth, you would need a third dimension to the array of unknown depth.

You can also easily have an array of something like dates.

DentistVisit[1] = 12/3/2001

DentistVisit[2] = 5/12/2002

DentistVisit[3] = 12/11/2002

. . .

DentistVisit[6] = 5/11/2003

Here the numbering of the array elements increases as the date is more recent.

Finally, we talk about the issue of numbering.  By default arrays in Java start with numbering at 0.  This can make some associations between numbers and contents a bit difficult at times.  But once you start working with this approach you'll adjust.

The following diagram represents some of the basic syntax and properties for arrays.