0
正确[],student []和numIncorrect已被初始化,但missedArray一直显示为空arrray。int中的int数组初始化
public static int[] missedArray(char[] correct, char[] student, int numIncorrect)
{
int[] missedArray = new int[numIncorrect];
for(int i = 0, j = 0; i < correct.length; i++)
{
if (student[i] != correct[i])
{
missedArray[j] = i+1;
j++;
}
}
return missedArray;
如何调用此方法? – 2014-12-04 06:31:22
传入的数据很重要。 – KevH 2014-12-04 06:32:57
missedArray [] = missedArray(correct,student,numIncorrect) – 2014-12-04 06:33:14