Array List


Site hosted by Angelfire.com: Build your free website today!
- A java class that implements a dynamcially growing array of objects
- Stores a sequence of objects of type Object
- All Classes hava the parebnt class Oject (inheritance)

Declaring & Instantiating


ArrayList name=new ArrayList(); //creats andempty array of size 0

import java.util.ArayList;

Adding objects


name.add(new Student("David",94,96,84)); //list expands and adds new Object to end of list

Removing objects from list


Student temp=(Student) name.get(0); //sets temp to the object
name.remove(0); //removes the element at the first index and shifts all neccesary objects and resizes the array minus one;

~~~~Home~~~~