public static void main(String[] args) {
List list = new ArrayList();
list.add(new Person("刘一", 15));
list.add(new Person("陈二", 15));
list.add(new Person("张三", 15));
list.add(new Person("李四", 15));
list.add(new Person("王五", 15));
list.add(new Person("赵六", 15));
list.add(new Person("田七", 18));
list.add(new Person("周八", 15));
list.add(new Person("吴九", 15));
list.add(new Person("郑十", 15));
list.add(new Person("马六", 15));
if ("田七".equals(p.getName())) {
it.set(new Person("孙七", 15));
}
}
System.out.println(list);
|
|