需求:比较三个人的身高。
public class lx01{
public static void main(String[] args){
int height1 = 150;
int height2 = 165;
int height3 = 180;
int temp = height1 > height2 ? height1 : height2;
System.out.println("temp:"+temp);
int max = temp > height3 ? temp : height3;
System.out.println("max:"+max);
}
} |
|