public class Student {
String name;
String className;
Student(String name, String className) {
this.name = name;
this.className = className;
}
}

import java.util.ArrayList;
public class Test9 {
public static void main (String[] args) {
ArrayList<Student> school = new ArrayList<Student>();

Student student = new Student("日経 太郎", "A");
school.add(student);
student = new Student("日経 花子","B");
school.add(student);

for(int i = 0; i < school.size(); i++) {
student = school.get(i);
System.out.println("生徒の名前は" + student.name +
", 学級は" + student.className + "です");
}
}
}