显示所有学生

时间:2018-09-27 16:49:06

标签: java

嗨,我有一个问题正在向所有学生显示错误:

    EnrollmentMain.java:58: error: incompatible types: Object cannot be converted to Student
    Student stud = classList.get(index);


 `  EnrollmentMain.java:60: error: cannot 
    find symbol
    System.out.println("NAME: 
    "+stud.name());`

这是58-60行:

public void displayAllStudents() {

    int index = 0;
    while(index < classList.size()) {
        Student stud = classList.get(index);
    //just use the way you output name 

        System.out.println("NAME: "+stud.name());
        index++;
}

我正在做一个ArrayList

0 个答案:

没有答案