求解newStudent的返回值問題~
Student newStudent=new Student(stuID,name);
students.put(stuID, newStudent);
這樣輸入為什么newStudent是一個value值(即輸入為什么是學生的姓名)
Student newStudent=new Student(stuID,name);
students.put(stuID, newStudent);
這樣輸入為什么newStudent是一個value值(即輸入為什么是學生的姓名)
2015-03-23
舉報
2015-04-16
這里的value ?是包含id和name的 不然 ?怎么知道這個name就屬于這個id呢
2015-03-23
students.put(stuID, newStudent);
中的students是哪里來的?????????????????
2015-03-23
public class Student{
public String id;
public String name;
public Set<Course> courses;
public Student(String id,String name){
this.id=id;
this.name=name;
this.courses=new HashSet<Course>();
}
}
??
newStudent是這樣的
2015-03-23
至于你的問題,我沒有你的代碼也回答不了你。
2015-03-23
Student newStudent=new Student(stuID,name);
實例化Student對象,并給這個對象傳入兩個屬性。stuID,name
students.put(stuID, newStudent);
調用Student對象的put方法,并傳入兩個屬性。stuID, newStudent