浅学之三元运算符


//三元运算符
public class Demo05 {
    public static void main(String[] args) {
        //x ? y :z
        //如果x==true,则结果为y,否则结果为z
        int score = 20;
        String type = score < 60 ?"不及格" :"及格";
        System.out.println(type);
    }
}

浅学之三元运算符

原创文章,作者:,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/268338.html

(0)
上一篇 2022年6月19日 08:50
下一篇 2022年6月19日 08:51

相关推荐

发表回复

登录后才能评论