📜  java arraylist add - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:48.694000             🧑  作者: Mango

代码示例3
import java.util.ArrayList;
public class Details {
    public static void main(String[] args) {

        //ArrayList Declaration
        ArrayList al= new ArrayList();
        //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);