32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
|
package exp8;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
|
||
|
public class StudentsList {
|
||
|
public static void main(String[] args) {
|
||
|
ArrayList<Student> students = new ArrayList<Student>();
|
||
|
|
||
|
// 外包1班的学生
|
||
|
students.add(new Student("张三", "外包1班"));
|
||
|
students.add(new Student("李四", "外包1班"));
|
||
|
students.add(new Student("王五", "外包1班"));
|
||
|
students.add(new Student("赵六", "外包1班"));
|
||
|
students.add(new Student("孙七", "外包1班"));
|
||
|
|
||
|
// 计算机应用1班的学生
|
||
|
students.add(new Student("周八", "计算机应用1班"));
|
||
|
students.add(new Student("吴九", "计算机应用1班"));
|
||
|
students.add(new Student("郑十", "计算机应用1班"));
|
||
|
|
||
|
// 计算机应用2班的学生
|
||
|
students.add(new Student("陈十一", "计算机应用2班"));
|
||
|
students.add(new Student("蒋十二", "计算机应用2班"));
|
||
|
students.add(new Student("沈十三", "计算机应用2班"));
|
||
|
students.add(new Student("韩十四", "计算机应用2班"));
|
||
|
|
||
|
for(Student s: students){
|
||
|
s.show();
|
||
|
}
|
||
|
}
|
||
|
}
|