package imooc;
import java.util.Arrays;
public class HelloWorld {
public static void main(String[] args) {
HelloWorld helloworld = new HelloWorld();
int[]scores = new int[] {23,34,45,21,119,-223,72};
helloworld.Sort(scores); //报错
}
public void Sort(int[]scores) {
Arrays.sort(scores);
int[]score = new int[3];
int count=0;
for(int i=0;i<scores.length;i++) {
if(scores[i]>100) {
continue;
}
else {
if(count>3) {
break;
}
else {
score[count] = scores[i]; //报错
count++;
}
}
}
System.out.println(Arrays.toString(score));
}
}
为什么会报错 一脸懵逼
慕婉清0_郁乱我心
相关分类