亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

求助,大神幫忙看看

求助,大神幫忙看看

Tanh 2017-04-11 10:43:57
import java.util.Arrays;;public class ScoreSort { int[] scores={89,-23,64,91,119,52,73}; public static void main(String[] args) { System.out.println("考試成績的前三名為:"); ScoreSort a = new ScoreSort(); a.showTop3(scores); } public void showTop3(int []scores){ Arrays.sort(scores); int num=0; for(int i=scores.length-1;i>=0;i++){ if(scores[i]<0||scores[i]>100){ continue; } num++; if(num<=3) System.out.println(scores[i]); else break; } } }為什么a.showTop3(scores); 括號內score會報錯Cannot make a static reference to the non-static field scores,要怎么改
查看完整描述

1 回答

已采納
?
younghu

TA貢獻25條經驗 獲得超6個贊

這是基礎啊, ?你score 數組不是靜態的 ! 在scores前價格static好了

查看完整回答
反對 回復 2017-04-11
  • 1 回答
  • 0 關注
  • 1252 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號