import java.util.Arrays;
public class HelloWorld {
//完成 main 方法
public static void main(String[] args) {
int[] scores ={ 89,-23,64,91,119,52,73};
System.out.println("考试成绩的前三名为:");
HelloWorld hello = new HelloWorld();
hello.getScores(scores);
public void getScores(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){
break;
}
System.out.println(scores[i]);
}
}
}
--------------------
/85/1598/BCq2/HelloWorld.java:13: error: illegal start of expression
public void getScores(int[] scores){
^
/85/1598/BCq2/HelloWorld.java:13: error: illegal start of expression
public void getScores(int[] scores){
^
/85/1598/BCq2/HelloWorld.java:13: error: ';' expected
public void getScores(int[] scores){
^
/85/1598/BCq2/HelloWorld.java:13: error: ';' expected
public void getScores(int[] scores){
^
/85/1598/BCq2/HelloWorld.java:29: error: reached end of file while parsing
}
^
5 errors
因为你少了main方法的后花括号,应放在hello.getScores(scores);后面