I have the following method:
public static List<Integer> gradingStudents(List<Integer> grades) {
for(int i = 0; i < grades.size(); i++){
if(grades.get(i) < 40)
continue;
else if(grades.get(i) % 5 < 3)
grades.get(i) = grades.get(i) + (Math.abs(grades.get(i)%5-5));
else
continue;
}
return grades;
}
I get an unexpected type error at else if
part. Why can't I change the element of grades
, like I wrote in the code, above?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…