how to add to arraylists in java code example

Example 1: how to add to an arraylist java

import java.util.ArrayList;
public class Details {
    public static void main(String[] args) {

        //ArrayList<String> Declaration
        ArrayList<String> al= new ArrayList<String>();
        //add method for String ArrayList
        al.add("Ram");
        al.add("Shyam");
        al.add("CPS");
        al.add("John");
        al.add("Steve");
        System.out.println("Elements of ArrayList of String Type: "+al);

Example 2: java arraylist

List<String> expenseTypeList = new ArrayList<>();
        expenseTypeList.add("GENERAL");
        expenseTypeList.add("PURCHASE");
        expenseTypeList.add("PROJECT");

Example 3: arraylist in java

Size is dynamic
Only supports objects
not syncronized
array based class