出现:Error: Could not find or load main class HelloWorld
package com.imooc;
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.printScores(scores);
}
// 定义方法完成成绩排序并输出前三名的功能
public void printScores(int[] scores) {
int count = 0;
Arrays.sort(scores);
for (int i = scores.length - 1; i >= 0; i--) {
if (scores[i] > 0 && scores[i] < 100) {
System.out.print(scores[i]+"、");
count++;
}
if (count == 3)
break;
}
}
}