這個哪里錯了,提示我main方法錯了
import java.util.Arrays;
public class HelloWorld {
? ? public void num(int[] nums){
? ? ? ? System.out.println("考試成績的前三名為");
? ? ? ? Arrays.sort(nums);
? ? ? ? int a = 1;
? ? ? ? for(int i=(nums.length-1);i>=0;i--){ ??
? ? ? ? if(nums[i]<0||nums[i]>100){
? ? ? ? ? ? continue;
? ? ? ? }
? ? ? ? ? ??System.out.println(nums[i]);
? ? ? ? ? ? a++;
? ? ? ? ? ? if(a>3)
? ? ? ? ? ? break;
? ? }
? ? public static void main(String[] args) {
? ? ? ? int[] scores={89,-23,64,91,119,52,73};
? ? ? ? HelloWorld hello=new HelloWorld();
? ? ? ? hello.num(scores);
? ? }
}
2016-12-28
首先你a的內循環就不對了,不是輸出前三的成績
2016-12-28
還發現少個括號=-=