通过迭代器出错?
public void testIterator() {
//通过集合的iterator方法,取得迭代器的事例
Iterator it = (Iterator) coursesToSelect.iterator();
System.out.println("有如下课程待选(通过迭代器访问):");
while(it.hasNext()) {
Course cr =(Course)it.next();
System.out.println("课程:" + cr.id+ ":" + cr.name);
}
}