previous | start | next

Example ( main method)

The element type to be stored in the ArrayList should be enclosed in <>

There is no need to specify the size of the ArrayList, it grows as needed when elements are added.

    1     public static void main(String[] args)
    2     {
    3       ArrayList<Integer> al = new ArrayList<Integer>();
    4       Random r = new Random();
    5   
    6       init(al);
    7       printArrayList(al);
    8   
    9     }


previous | start | next