这节课讲的这个for循环的一些问题
for(Course cr:st.courseToSelect){
if(cr.id.equals(courseId)){
student.courses.add(cr);
}
}for(Course cr:student.courses){
System.out.println("选择了课程:"+cr.id+"\t"+cr.name);
}这节课遍历List和set的时候都用对象的实例来引用,为什么之前的课程里的List就是直接用了呢?
for(Object obj:coursesToSelect){
Course cr=(Course)obj;
System.out.println("\t"+cr.id+"、"+cr.name);
}