//三元运算符 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 言语说 阅读(16) 评论(0) 编辑 收藏 举报
博客园 Copyright © 2024 言语说 Powered by .NET 9.0 on Kubernetes