這個(gè)哪里錯(cuò)了,提示我main方法錯(cuò)了
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的內(nèi)循環(huán)就不對(duì)了,不是輸出前三的成績
2016-12-28
還發(fā)現(xiàn)少個(gè)括號(hào)=-=