public static ArrayList <Student> createStudents()
{
ArrayList<Student> students;
students = new ArrayList<Student>();
students.add(new UndergradStudent("Kvin", 15, 'M', 4));
students.add(new GraduateStudent("Kaley", 24, 'F', "Expert Systems"));
students.add(new UndergradStudent("Mike", 25, 'M', 2));
students.add(new GraduateStudent("Bob", 20, 'F', "Extreme Programming"));
return students;
}
public static void printGradStudents(ArrayList<Student> students)
{
int count;
Student student;
System.out.println("\n\nList of Graduate Students:\n");
for (count=0; count<students.size(); count++)
{
student = students.get(count);
if (?)
{
System.out.println(student);
}
}
}
##研究生是Student的子类,如果只想打印研究生的信息,if语句中应该放什么?##