java基础三元运算符
//三元运算符
public class Demo04 {
public static void main(String[] args) {
//X ? Y : Z
//如果x为真输出Y反之输出Z
//实例 很常用
int score=70;
String type = score <60 ?"不及格" :"及格";
System.out.println(type);//小于60输出不及格 反之为及格
}
}
```
```
### x可以为一些运算
本文来自博客园,作者:{时凯},转载请注明原文链接:https://www.cnblogs.com/shikaiblog/articles/15244797.html

浙公网安备 33010602011771号