求指教,编译通过没语法错误,怎么就是没结果呢?
你确定编译通过?
public void getScores(int [] scores)这个方法没有返回值,但是你这句话 int score = hello.getScores(scores);又返回一个整形数据。
getScores()方法里面已经都写好了,直接调用就好了。不用在写这两句
int score = hello.getScores(scores);
System.out.println("考试成绩的前三名为:"+score);
改完之后的程序
import java.util.Arrays;
public class HelloWorld{
    
    //完成 main 方法
    public static void main(String[] args) {
    //定义一个成绩数组,保存预定的考试成绩    
    int [] scores={89,-23,64,91,119,52,73};    
    //调用自定义方法,传入成绩数组完成功能    
    HelloWorld  hello = new HelloWorld() ;
    hello.getScores(scores);
    }
    //定义方法完成成绩排序并输出前三名的功能
    public void getScores(int [] scores){
        Arrays.sort(scores);
        //定义变量,统计有效成绩的前三名的数量
        int count=0;
        //遍历数组,选择有效成绩
        for(int i=scores.length-1;i>=0;i--){
            if(scores[i]>0&&scores[i]<100){
                count++ ;
                if(count>3){
                    break;
                }
                else{
                //输出前三名
                  System.out.println(scores[i]);
                }
            }
            else{
                continue;
            }
        }
    }
}完全不懂你代码到底写的什么!你的子函数说的是要进行排序,得到前三名!你排序了嘛!而且没有返回值,但是你却将它赋值给了一个int变量!编译能通过,我这里提示类型不相容啊!