package cn.edu.bjut.chapter6; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ArrayListTester { public static void main(String[] args) { List strList = new ArrayList(); strList.add("123"); strList.add("456"); strList.add("234"); strList.add(2, "121"); System.out.println(strList); strList.remove(2); System.out.println(strList); for (int i = 0; i < strList.size(); i++) { System.out.print(strList.get(i) + "\t"); } System.out.println(); for (Iterator it = list1.iterator(); it.hasNext();) { System.out.print(it.next() + "\t"); } System.out.println(); } }