1import java.util.ArrayList;
2
3public class ArrayListDemo {
4 public static void main(String[] args) {
5 ArrayList<String> arrlist = new ArrayList<String>(5);
6 arrlist.add("G");
7 arrlist.add("E");
8 arrlist.add("F");
9 arrlist.add("M");
10 System.out.println("Size of list: " + arrlist.size());
11 for (String value : arrlist) {
12 System.out.println("Value = " + value);
13 }
14 int retval=arrlist.indexOf("E");
15 System.out.println("The element E is at index " + retval);
16 }
17}