ArrayList is a part of collection framework and in the java.util package of the Java API. It provides us dynamic data structure
ArrayList inherits AbstractList class and implements List interface.
ArrayList can be instantiated with a size, the size can increase if collection grows or shrinks when objects are added and removed.
Java ArrayList allows random access of list content.
ArrayList can only contain objects. For primitive types such as int, char, boolean, double etc, a wrapper class is needed for such cases.
ArrayList list = new ArrayList(); //list can contain all types of objects
list.add(1); //possible even if 1 is int because of boxing/wrapping
list.add("Box"); //a string can also be added to the same list
list.add(true); //a boolean value can also be added to the same list
ArrayList<String> list = new ArrayList(); //list only contains elements of String type
list.add("Elephant");
list.add("Panda");
list.add("Comodo Dragon");
ArrayList<Integer> numbers = new ArrayList(); //list only contains elements of Integer type
numbers.add(12);
numbers.add(189);
numbers.add(85);
ArrayList<Circle> circles = new ArrayList(); //list only contains elements of Circle type
circles.add(new Circle(9.4));
circles.add(new Circle(12.3));
circles.add(new Circle(3.14));