this is the code
public static String[] getgrades(int[] testMarks){
String grade[] = new String[1000];
int marks = testMarks[0];
for (int count=0; count < testMarks.length ; count++){
if (testMarks[count]>90)
grade[count]="A";
else if (testMarks[count]>75)
grade[count]="B";
else if (testMarks[count]>60)
grade[count]="C";
else if (testMarks[count]>40)
grade[count]="D";
else
grade[count]="F";
return grade[];
}
}
答案 0 :(得分:1)
You return the result inside of your loop. That means you never get to the second grade
.
Place the return statement outside (after) your loop.
Also your grade[]
has a constant size of 1000 instead of the size you want (which is testMarks.length
).