遍历for的时候转换类型错误,请教大神
public static void main(String[] args) {
SetTest st=new SetTest();
st.testAdd();
st.testForEach();
//创建一个学生对象
Student student=new Student("1","小明");
System.out.println("欢迎学生:"+student.name+"选课!");
//创建一个Scanner对象,用来接受从键盘输入的课程ID
Scanner console=new Scanner(System.in);
for(int i=0;i<3;i++) {
System.out.print("请输入课程ID");
String courseId=console.next();
for(Course cr:st.coursesToSelect) {
if(cr.id.equals(courseId)) {
student.courses.add(cr);
}
}
for(Course cr:student.courses ){
System.out.println("选择了课程:"+cr.id+":"+cr.name);
}
}