日期:2014-05-20 浏览次数:20770 次
public class TestArrayList {
public static void main(String[] args) {
ArrayList<Stu> list = new ArrayList<TestArrayList.Stu>();
list.add(new Stu("A"));
for (Stu stu : list) {
stu = new Stu("B");
}
for (Stu stu : list) {
System.out.println(stu.name);
}
}
static class Stu{
public String name;
public Stu(String name) {
this.name = name;
}
}
}