import java.util.ArrayList; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("1"); arrayList.add("2"); arrayList.add("3"); for (int i = 0; i < arrayList.size(); i++) { String s = arrayList.get(i); System.out.println(s); } } }
运行结果
1 2 3