運(yùn)行沒有錯(cuò)誤,但構(gòu)建失敗,請(qǐng)大神幫我看看哪里錯(cuò)了
package javaapplication1;
import java.util.Arrays;
public class zheng {
? ? public static void main (String[] args){
? ? int[] scores={89,-23,64,91,119,52,73};?
? ? ? ? zheng zdy=new zheng();
? ? ? ? zdy.zheng(scores); ? ?
? ? }?
? ? //定義方法完成成績排序并輸出前三名的功能
? ? public void zheng(int[] scores){
? ? ? ? int t,x=0; ??
? ? ? ? for(int i=7;i>0;i--){
? ? ? ? ? ? for(int j=0;j<i;j++){
? ? ? ? ? ? ? if(scores[j]<scores[j+1]){
? ? ? ? ? ? ? t=scores[j];scores[j]=scores[j+1];scores[j+1]=t; ?
? ? ? ? ? ? ? }
? ? ? ? ? ? ? }}
? ? ? ? for(int h=0;h<7&&x<3;h++){
? ? ? ? ? ? if(scores[h]>=0&&scores[h]<=100){
? ? ? ? ? ? ? ? x++;
? ? ? ? ? ? ? ? System.out.println(scores[h]);
? ? ? ? ? ? }
? ? ? ? }? ? ??
}
}
2017-02-07
把zheng()里的第一個(gè)for循環(huán)改成如下:
求采納!