Accessing array elements

Array elements are accessed by using the square brackets notations and specifying the element index between them. The first index in an array is 0, so if we were to assign the first element in an array to another variable it could look like this:

The variable that is assigned the value must be of the same data type as the elements of the array. The exception is a super class type to a reference type.
As a matter of fact, the first element in the array as well as all other elements is variables too. The difference between them and other variables is that a normal variable is accessed through a name but an array variable has no name and is accessed through an index value.

Search for more Java info on this site here:
Custom Search

Any thoughts or questions?