Step 3: ArrayListDemo Class
ArrayListDemo class defines an ArrayList object and demonstrates the usage of various methods of 'ArrayList' class.
boolean add(Object o)
Object get(int index)
int size()
Use 'for each' loop to iterate through the list, use 'compareTo' method to find the number. Use 'set' method to set new element. The full signature of this ArrayList method is
Object set(int index, Object element)
Get the index of the given integer in the ArrayList using 'indexOf' method.
Remove the element at the index position using 'remove' method, the signature is
Object remove (int index)
int indexOf(Object elem)
void clear()