三元运算符
package com.changl.operator;
//三元运算符
public class Demo08 {
public static void main(String[] args) {
// x ? y : z
// if x==true,则结果为y,否则结果为z
int socre = 80;
String type = socre < 60 ?"不及格" : "及格";//必须掌握
System.out.println(type);
}
}
-------------------------------------------------------------------------
及格
浙公网安备 33010602011771号