class Student{
private String name;
private int age;
public Student() {
super();
// TODO Auto-generated constructor stub
}
public Student(String name, int age) {
super();
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
public class StudentTest {
public static void main(String[] args) {
Student s = new Student("李明",20);
Student s1 = new Student("张明",20);
Student s2 = new Student("王明",20);
Student s3 = new Student("周明",20);
Student s4 = new Student("吴明",20);
Student[] ss = new Student[]{s,s1,s2,s3,s4};
for (int i = 0; i < ss.length; i++) {
System.out.println(ss[i].getName()+""+ss[i].getAge());
}
}
} |
|