[1228 views]
In Java, ArrayList is a resizable array, which can also be defined as a sequential order of elements. Unlike simple arrays, Java ArrayLists are more flexible and can contain many data types. This article shows you how to use this feature.
The Java ArrayList class uses a dynamic array to store its elements. It is similar to an array but has no size limit. We can add or remove items at any time. This makes them much more flexible than traditional arrays.
Element can be added in Java ArrayList using add() method of java.util.ArrayList class.
The element passed as a parameter gets inserted at the end of the list.
The element specified in parameter will get added to the end of the list and this method returns a boolean value true.