java 習題
為指定成績加分,直到分數大于等于 60 為止,輸出加分前和加分后的成績,并統計加分的次數
public class HelloWorld {
? ? public static void main(String[] args) {
? ? ? ? int score = 53;?
? ? ? ? System.out.print("加分前成績:" + score);
? ? ? ? int count = 0;
? ? ? ? if(socre<60)
? ? ? ? {
? ? ? ? ? ? for(;score<60;score++)
? ? ? ? ? ? {
? ? ? ? ? ? ? ? count++;
? ? ? ? ? ? }
? ? ? ? ? ? System.out.print("加分后成績:" + score); ? ? ?
? ? ? ? ? ? System.out.print("共加了" + count+"次!"); ?
? ? ? ? }
? ? ? ? else
? ? ? ? System.out.print("不需要加分");
? ? ? ? }
}
?哪里不對嗎 ?
這是它指出的問題
/85/1554/CSM6/HelloWorld.java:9: error: cannot find symbol
? ? ? ?if(socre<60)
? ? ? ? ? ^
?symbol: ? variable socre
?location: class HelloWorld
1 error
2016-03-10
單詞打錯了,if里的打成socre了
2016-03-10
樓上說的對 應該是score