Home Segments Top Top Previous Next

506: Mainline

An array contains a collection of elements, all of which have the same primitive type or class, that Java stores and retrieves using an integer index. In Java, the first element of an array is indexed by zero; hence, Java is said to have zero-based arrays.

The following, for example, is a one-dimensional array, of length 4, with integer elements:

   0    1    2    3        <-- Index 
*----*----*----*----* 
| 65 | 87 | 72 | 75 | 
*----*----*----*----*