編碼里的及格不及格應(yīng)該怎么修改一下
public class HelloWorld{
? ? public static void main(String[] args) {
int score=68;
String mark =(score>=60)?及格;不及格;
System.out.println("考試成績(jī)?nèi)绾危?+mark);
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problems:?
Syntax error on token "Invalid Character", invalid (
及格 cannot be resolved to a variable
不及格 cannot be resolved to a variable
at com.imooc.bianliang.main(bianliang.java:6)
應(yīng)該怎么修改呢
2017-03-23
應(yīng)該是這個(gè)樣子的,希望對(duì)你有幫助呢~
2017-03-23
這句代碼有問(wèn)題;
代碼中不允許出現(xiàn)中文符號(hào),這句的小括號(hào)和末尾分號(hào)都是中文的吧,三元運(yùn)算符的語(yǔ)法也不對(duì),中間應(yīng)該是冒號(hào)不是分號(hào),另外,字符串應(yīng)該用英文雙引號(hào)包裹,修改如下:
求采納求采納!
2017-03-23
及格:(冒號(hào))不及格;