import java.util.ArrayList;
public class CreateAndGet {
public static void main(String[] args) {
// TODO Auto-generated method stub
ArrayList arrayList = new ArrayList();
arrayList.add("1");
arrayList.add("2");
arrayList.add("3");
System.out.println("Getting elements of ArrayList");
System.out.println(arrayList.get(0));
System.out.println(arrayList.get(1));
System.out.println(arrayList.get(2));
}
}
Console:
Getting elements of ArrayList
1
2
3