Java Array
Description
An array is a named set of variables of the same type.
Each variable in the array is called an array element.
Index
To reference an element in an array, we use the array name combined with an integer value, called index.
The index is placed between square brackets following the array name; for example,
data[9]
refers to the element in the data array corresponding to the index value 9.
Index Value
The index for an array element is the offset of the element from the beginning of the array.
The first element has an index of 0, the second has an index of 1, the third an index of 2, and so on.
data[9] refers to the tenth element in the data array.
The index value does not need to be an integer literal, it can also be a variable.
The array index has to have a value equals to or greater than zero.