package com.imooc;mport java.util.Arrays;public class HelloWorld { public static void main(String[] args) { HelloWorld hello = new HelloWorld(); int[] scores = {89 , -23 , 64 , 91 , 119 , 52 , 73}; hello.getBestThree(scores); } //定义方法完成成绩排序并输出前三名的功能 public void getBestThree(int[] scores){ Arrays.sort(scores); int num=0; for(int i=scores.length -1 ;i--) { if(scores[i]<0||scores[i]>100) { continue; } num++; if(num>3) { break; } System.out.println(score[i]); } } }编译后问题:Exception in thread "main" java.lang.Error: Unresolved compilation problem: at com.imooc.HelloWorld.main(HelloWorld.java:5)
添加回答
举报
0/150
提交
取消