嵌套循環(huán)if 一定要注意自己的 作用域的問題,我也是琢磨了很久才發(fā)現(xiàn),最后的一個(gè)判斷 else 應(yīng)該在 if 之外, 注意最后的else出現(xiàn)在if大括號(hào)之外。
2014-12-02
public class HelloWorld{
public static void main(String[] args) {
String hobby="慕課網(wǎng)";
System.out.println(hobby);
}
}
public static void main(String[] args) {
String hobby="慕課網(wǎng)";
System.out.println(hobby);
}
}
while (score<60){
score=score+1;
count++;
}
System.out.println("加分后成績(jī):"+score);
System.out.println("共加了"+count+"次");
score=score+1;
count++;
}
System.out.println("加分后成績(jī):"+score);
System.out.println("共加了"+count+"次");
2014-12-01