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