哪位java大牛能夠幫幫忙解答下呢,跪謝啦。
阿新 • • 發佈:2018-12-02
import java.util.ArrayList;
public class Main{
private ArrayList slist = new ArrayList();
public void addStudent(Student s)
{
this.slist.add(s);
}
public void showStudent()
{
for (Student s:slist)
{
System.out.println(s);
}
}
public static void main(String[] args) {
Main t = new Main();
t.addStudent(new Student(“2016001”,“rose”,18));
t.addStudent(new Student(“2016002”,“hunifu”,19));
t.addStudent(new Student(“2016003”,“britsh”,20));
t.addStudent(new Student(“2016004”,“sunni”,17));
t.showStudent();
}
}
class Student {
//補全程式碼處
Student(String str1,String str2,int num)
{
Object s=str1+" “+str2+” "+num;
}
}
就有這個錯誤,不知道怎麼改。除了補全程式碼那裡我補了一點,上面的程式碼題目說都是對的,不允許修改。