A first look at arrays

An array is a container object that holds a fixed number of values of a single type. The length of an array is established when the array is created. After creation, its length is fixed.

  • The first item of an array has an index value of 0
  • The length of an array is equal to the number of elements in the array
  • The last item of an array has an index value of one less than the number of elements
  • An array's length is fixed. You can change the value of the items but you can't add any new items
  • All items in the array have the same data type that was declared when the array was created

Things we can do with arrays

import java.util.Array

public ArrayDemo
{
    public static void main(String args[])
    {
        //Declare array
        //Initialize elements of an array
        //Print the elements of an array
        //print one element
        //Print every other element
        //Print the number of elements
        //Change an element
        //Change all the elements
        //Copy an array
        //Search for an element
        //Sort an array
    }
}