//创建集合对象
Collection c = new ArrayList();
Student s1 = new Student(“张三”, 20);
Student s2 = new Student(“李四”, 40);
Student s3 = new Student(“王五”, 50);
c.add(s1);
c.add(s2);
c.add(s3);
Iterator<Student> i = c.iterator();
while (i.hasNext()) {
Student n = i.next();
System.out.println(n.getName() + "," + n.getAge());
}