請問哪里出現問題了·····
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();
????? hello.threeHigh(scores);
?????
??? }
???
??? //定義方法完成成績排序并輸出前三名的功能
??? public void threeHigh(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>=2){
??????????????? break;
??????????? }
??????????? System.out.println(scores[i]);}
??????? }
??? }
???
???
2016-04-10
if(count>=2)這句,當count=1,條件為假,執行輸出打印91,然后循環,count=2,條件為真,執行break,程序結束.沒有機會執行輸出打印了.
2016-04-06
是照著老師給的代碼做的,還是運行不出來,試了下其他同學的代碼也沒有運行出來···
2016-04-06
count 應該是>3,才跳出循環
2016-04-05
覺得最好應該是排序好自后向前輸出不大于100的項,同時下標前移,設置計數器,這樣沒什么問題吧.....
2016-04-04
你的main方法里面沒有輸出
2016-04-04
同學你得先按大小排序然后再刪除不合格的成績