判断及格与否

public class Demo08 {
public static void main(String[] args) {
/*
三元运算符
X ? Y : Z
如果x==true,则结果为Y,否则返回Z.
*/
int score = 60;
//判断及格与否
String perform = score < 60?"不及格":"及格";
System.out.println(perform);
}
}

输出:

及格

Process finished with exit code 0

posted @ 2021-08-20 09:19  小风扇呜呜呜  阅读(48)  评论(0)    收藏  举报