public class HelloWorld{
public static void main(String[] args) {
int score=68;
String mark =(score>=60)?"及格":"不及格";
System.out.println("考试成绩如何:"+mark);
}
}
<code>public class HelloWorld{
public static void main(String[] args) {
int score=68;
String mark = (score>=60)?"及格":"不及格";
System.out.println("考试成绩如何:"+mark);
}
}
</code>
三元运算符里的问号是中文的,后两行代码前面好像还有全角空格,直接复制粘贴下面的试试吧
public class HelloWorld{ public static void main(String[] args) { int score=68; String mark = (score > 60) ? "及格" : "不及格"; System.out.println("考试成绩如何:"+mark); } }
求采纳
+在Mark前面