編程練習(xí)題
為什么這段代碼放在Myeclipse里面就不行了呢。提示有錯(cuò)誤
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+次!");
}
}
錯(cuò)誤提示: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是當(dāng)條件滿足時(shí)執(zhí)行,應(yīng)該改為score<60,你這樣程序不滿足不能執(zhí)行,另外樓上指出了,你最后一行差標(biāo)點(diǎn)符號了~~錯(cuò)誤提示里面有說第六行
2015-11-20
("共加了"+count+"次!");