import java.util.ArrayList;
class ArrayListTest
{
public static void main
(String [] args
) {
//Standard Java arrays are of a fixed length. After arrays are created,
//they cannot grow or shrink, which means that you must know in advanced
//how many elements an array will hold.
//Array lists are vreated with an initial size. When this size is exceeded
//the collection is automatically enlarged. When objects are removed,
//the array may be shrunk.
ArrayList<String> names = new ArrayList<>();
names.add("James");//0
names.add("Peter");//1
names.add("John");//2
names.add("Jake");//3
names.add("Paul");//4
for (int i = 0 ; i < names.size(); i++)
{
System.
out.
println(names.
get(i
)); }
}
}