Course[] course ={new Course("3","离散数学"),new Course("4","汇编语言")};courseToSelect.addAll(Arrays.asList(course));Course temp3=(Course)coursesToSelect.get(2);Course temp4=(Course)coursesToSelect.get(3);System.out.println("添加了两门课程:"+temp3.id+":"+temp3.name+";"+temp4.id+":"+temp4.name);Course[] course2 ={new Course("4","数学数学"),new Course("5","大学英语")};courseToSelect.addAll(2,Arrays.asList(course2));Course temp5=(Course)coursesToSelect.get(4);Course temp6=(Course)coursesToSelect.get(5);System.out.println("添加了两门课程:"+temp5.id+":"+temp5.name+";"+temp6.id+":"+temp6.name);为什么写的时间没有报错,在MyEclipse会运行错误??(别的代码与课程的代码都是一样的) |