請教一下各位大佬,我這個為什么通過不了。。
import java.util.Arrays;
public class HelloWorld {
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? ? ? int[] scores={89,-23,64,91,119,52,73};
? ? ? ?HelloWorld hello=new HelloWorld();
? ? ? ?System.out.println("考試成績的前三名為:");
? ? ? ?hello.showTop3(scores);
? ? }
? ??
? ? //定義方法完成成績排序并輸出前三名的功能
? ??
? ? public? void showTop3(int[] scores)
? ? {
? ? ? ? int num=0;
? ? ? ? Arrays.sort(scores);
? ? ? ? for(int i=scores.length-1;i>=0;i--)
? ? ? ? {
? ? ? ? ? ? if(scores[i]>=0&&scores[i]<=100)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? System.out.println(scores[i]);
? ? ? ? ? ? ? ? num++;
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? ? ? if(num>=3)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? break;
? ? ? ? ? ? }
? ? ? ? }
? ? }
? ? }
2018-04-03
39行多了一個右大括號
2018-04-09
我剛剛復制了代碼重新提交不知道為什么就通過了。。。。