next up previous
Next: Declaration of array variables Up: Unit 07 Previous: Summary

Array

An array object (or simply array) contains a collection of elements of the same type, each of which is indexed (i.e., identified) by a number. A variable of type array contains a reference to an array object.

To use an array in Java we have to:

  1. declare a variable of type array that allows us to refer to an array object;
  2. construct the array object specifying its dimension (number of elements of the array object);
  3. access the elements of the array object through the array variable in order to assign or obtain their values (as if they were single variables).


next up previous
Next: Declaration of array variables Up: Unit 07 Previous: Summary