问答详情
源自:7-1 编程练习

第一季最后一道

import java.util.Arrays;

import java.util.Scanner;

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.showTop3(scores);

    }

        

    public void showTop3(int[]scores){

        Arrays.sort(scores);

        int num=0;

        for(int i=scores.length-1;i>=0;i--){

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

               continue;

           }

           num++;

           if(num>3){

              break; 

           }

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

            

        }

        

    

    }

这个代码在网页上是可以输出结果的 但是为什么在myeclipse里面一直弹错??


Exception in thread "main" java.lang.Error: Unresolved compilation problem: 


at chuan.HelloWorld.main(HelloWorld.java:9)


提问者:greenhandc 2015-12-07 18:23

个回答

  • 和C说88
    2015-12-07 19:34:11
    已采纳

    我在idea中可以运行,上面的程序末尾少个}。