为什么运行失败啊

来源:7-1 编程练习

qq_慕运维7174717

2019-09-14 15:36

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回答

  • Code小白k1
    2019-09-14 16:46:29
    已采纳

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

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


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

    qq_慕运维...

    谢谢!!

    2019-09-22 19:45:40

    共 1 条回复 >

  • weixin_慕仔2595270
    2019-10-06 23:05:41

    first应该小于3吧。。。?

Java入门第一季(IDEA工具)升级版

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

1163380 学习 · 17551 问题

查看课程

相似问题