三元运算符

package operator;

public class Demo08 {
public static void main(String[] args) {
//三元运算符 x ? y : z
// 如果 x = true 则 y 否则 z

int score = 60;
String type = score < 50 ? "不及格" : "及格";
System.out.println(type);


}
}
posted @ 2021-04-23 14:03  杨得体  阅读(90)  评论(0)    收藏  举报