編程練習題
為什么這段代碼放在Myeclipse里面就不行了呢。提示有錯誤
package newnew;
public class helloword {
?public static void main(String[] args){
?int score =53;
?int count =0;
?System.out.println("加分前成績:"+score);
?while(score>=60){
??score=score+1;
??count++;
?}
?System.out.println("加分后成績:"+score);
?System.out.println("共加了+count+次!");
}
}
錯誤提示:Description?Resource?Path?Location?Type
The value of the local variable count is not used?helloword.java?/wenwen/src/newnew?line 6?Java Problem
2015-11-28
while是當條件滿足時執行,應該改為score<60,你這樣程序不滿足不能執行,另外樓上指出了,你最后一行差標點符號了~~錯誤提示里面有說第六行
2015-11-20
("共加了"+count+"次!");