为了账号安全,请及时绑定邮箱和手机立即绑定

为什么运行失败啊

import java.ntil.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.three(socres);

        

    }

    

    //定义方法完成成绩排序并输出前三名的功能

    public void three (int []socres){

    Arrays.sort(scores);

    int first = 0;

    for(int i = socres.length - 1 ; i >= 0&&first<=3;i--)

    {

    if (scores[i]<0||socres[i]>100)

    continue;

    first++;

    System.out.println(scores[i]);

    

    }

  }    

       

}



正在回答

2 回答

import java.ntil.Arrays;//ntil 改为 util

HelloWorld hello = new helloWorld();//helloWorld()改为HelloWorld()


scores  这个数组名 有好几个拼错了 

1 回复 有任何疑惑可以回复我~
#1

qq_慕运维7174717 提问者

谢谢!!
2019-09-22 回复 有任何疑惑可以回复我~

first应该小于3吧。。。?

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
Java入门第一季(IDEA工具)升级版
  • 参与学习       1163409    人
  • 解答问题       17551    个

0基础萌新入门第一课,从Java环境搭建、工具使用、基础语法开始

进入课程

为什么运行失败啊

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信