public class ArrayList {
Object[] objects = new Object[10];
int index = 0;
public void add(Object object) {
if (index == objects.length) {
Object[] newObjects = new Object[objects.length*2];
System.arraycopy(newObjects, 0, objects, 0, objects.length);
objects = newObjects;
}
objects[index++] = object;
}
public int length() {
return index++;
}
}