package com.company.DaYuanXue;
import java.util.ArrayList;
public class ArrayStudent {
public static void main(String[] args) {
ArrayList<Student> List= new ArrayList<>();
Student one = new Student("周杰伦",23);
Student two = new Student("孙燕姿",22);
Student three = new Student("刘德华",21);
Student four = new Student("林俊杰",26);
List.add(one);
List.add(two);
List.add(three);
List.add(four);
for (int i = 0; i < List.size(); i++) {
Student stu = List.get(i);
System.out.println("学生的姓名是:"+stu.getName()+",年龄是:"+stu.getAge());
}
}
}