import java.util.Arrays;;public class ScoreSort { int[] scores={89,-23,64,91,119,52,73}; public static void main(String[] args) { System.out.println("考试成绩的前三名为:"); ScoreSort a = new ScoreSort(); a.showTop3(scores); } public void showTop3(int []scores){ Arrays.sort(scores); int num=0; for(int i=scores.length-1;i>=0;i++){ if(scores[i]<0||scores[i]>100){ continue; } num++; if(num<=3) System.out.println(scores[i]); else break; } } }为什么a.showTop3(scores); 括号内score会报错Cannot make a static reference to the non-static field scores,要怎么改
添加回答
举报
0/150
提交
取消