public class Demo{
public static void main(String[] args){
int height1=1;
int height2=2;
int height3=3;
//如果height1>height2则会输出tempHeight=height1,否则会输出tempHeight=height2
int tempHeight=height1>height2?height1:height2;
int maxHeight=tempHeight>height3?tempHeight:height3;
System.out.println("maxHeight"+maxHeight);
}
}
三元运算符之数据排序
最新推荐文章于 2022-12-02 18:24:49 发布