最后一章題
import java.util.Arrays;
public class HelloWorld {
? ??
? ? //完成 main 方法
? ? public static void main(String[] args) {
? ? int [] socres={89,-23,64,91,119,52,73};
? ? HelloWorld hello=new HelloWorld();
? ? hello.showTop3(scores);
? ??
? ? public void showTop3(int [] scores){
? ? ? ? Arrays.sort(scores);
? ? ? ? int count=0;
? ? ? ? for(int i=scores.length-1;i>=0;i--)
? ? {if(scores[i]<0 || scores[i]>100) continue;}
? ? count++;
? ? if(count>3)
? ? break;
? ? }
? ? System.out.println(scores[i]);
? ? } ? ?
幫忙找找錯誤
2017-12-05
你的大括號少了不說,那行打印輸出的代碼還放錯位置了,主函數(shù)定義數(shù)組scores寫成socres了
2017-12-05