8.1编程练习。请问该怎么在main函数中接收返回的数组?
import java.util.Arrays;
public class imooc8_1 {
//完成 main 方法
public static void main(String[] args) {
int[] scores = {89 , -23 , 64 , 91 , 119 , 52 , 73};
int[] arrays = new int[3];
imooc8_1 hello = new imooc8_1();
arrays = hello.check(scores);
for(int i = 0; i < arrays.length; i ++) {
System.out.println(arrays.[i]);
}
}
//定义方法完成成绩排序并输出前三名的功能
public int[] check(int[] scores) {
int valueScore = 0;
int vS[] = new int[3];
Arrays.sort(scores);
for(int i = scores.length - 1; i >= 0 && valueScore < 3; i --) {
if(scores[i] > 100 || scores[i] < 0)
continue;
else {
vS[valueScore++] = scores[i];
}
}
return vS;
}
}