package cn.itcast_01;
public class 对象数组的使用{
public static void main(String[] args) {
Student[] student = new Student[5];
Student s1 = new Student("天猫",15);
Student s2 = new Student("淘宝",26);
Student s3 = new Student("京东",25);
Student s4 = new Student("亚马逊",34);
Student s5 = new Student("Bil",34);
student[0]=s1;
student[1]=s2;
student[2]=s3;
student[3]=s4;
student[4]=s5;
for(int x =0;x<student.length;x++) {
System.out.println(student[x]);
Student s = student[x];
System.out.println(s.getName()+"------"+s.getAge());
}
}
}