案例:三个和尚
//需求:三个和尚的身高分别为150cm、210cm、165cm,用程序获取这三个和尚的最高身高
public class HelloWorld{
public static void main(String[] args){
int height1 = 150;
int height2 = 210;
int height3 = 165;
int tempHeight = height1 > height2 ? height1:height2;
int maxHeight = tempHeight > height3?tempHeight:height3;
System.out.println("maxHeight:"+maxHeight);
}
}