請(qǐng)問(wèn)哪里出錯(cuò)了
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("考試成績(jī)的前三名為:");
? ? ? Helloworld hello=new Helloworld
? ? ? hello.showTop3(scores);
? ? ? ??
? ? ? ??
? ? ? ??
? ? }
? ??
? ? //定義方法完成成績(jī)排序并輸出前三名的功能
? ? public void showTop3(int[] scores){
? ? ? ? Arrays.sort(scores);
? ? ? ? int num=0;
? ? ? ? for(int i=scores.length - 1;i>=0;i--){
? ? ? ? ? ? if(socres[i]<0 || socres[i]>100){
? ? ? ? ? ? ? ? continue;
? ? ? ? ? ? }?
? ? ? ? ? ? num++;
? ? ? ? ? ? if(num>3){
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? }
? ? }?
? ??
? ??
? ??
? ??
? ??
? ??
? ??
? ??
? ??
}
2017-06-18
?? Helloworld hello=new Helloworld 沒(méi)寫(xiě)分號(hào),
2017-07-15
Helloworld hello=new Helloworld
改為
HelloWorld hello=new HelloWorld();
注意W的大小寫(xiě)前后不一致,JAVA是區(qū)分大小寫(xiě)的。
2017-06-19
?Helloworld hello=new Helloworld();