最新回答 / 慕粉2009189
get方法輸入ID后,得到的是相對于Student對象,因為前面泛型已經規定好了Map<String,Student> students=new HashMap<String,Student>();
2019-11-19
最新回答 / 魔法少男小鍋鍋
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>(); }
2019-11-15
最新回答 / 云霄9
ID是給student class定義的,不是object@Override?? ?public int compareTo(Object o) {?? ??? ?// TODO Auto-generated method stub?? ??? ?return this.id.compareTo(o.id);?? ?}換成以下看看??@Override?? ?public int compareTo(Student o) { // <-- 看這里!!!?? ??? ?// TODO Auto-gen...
2019-11-08
最新回答 / 慕絲1322028
提前賦值隨機數其實是一種方法的重載,它表示取指定范圍的數。例如: Random r = new Random(),? int a = r.nextInt(100)表示可以取0-100的任意整數。而int b = r.nextInt() * 100取不到100,只能取0-99中的任意整數
2019-10-25