//三元运算符 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); } }
posted on 2022-06-19 08:03 言语说 阅读(22) 评论(0) 收藏 举报
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3