ArrayList is dynamic array in java. It can grow as new contents are added into the arrayList.
ArrayList in Java Example
package blogCollections;
import java.util.ArrayList;
public class arraylistExample {
public static void main(String args[])
{
// Initialize String arraylist
ArrayList strAL = new ArrayList();
// Add elements inside array list
strAL.add("One");
strAL.add("Two");
strAL.add("Three");
strAL.add("Four");
strAL.add("Five");
strAL.add("Six");
System.out.println("Values inside array list: "+ strAL);
}
}
Output:
Values inside array list: [One, Two, Three, Four, Five, Six]