import java.util.Scanner;
public class ScannerTest {
public static void main(String[] args){
//创建对象
Scanner sc = new Scanner(System.in);
//键盘录入
System.out.println("请输入第一个和尚的身高");
int height1 = sc.nextInt();
System.out.println("请输入第二个和尚的身高");
int height2 = sc.nextInt();
System.out.println("请输入第三个和尚的身高");
int height3 = sc.nextInt();
//运用三元运算符比较前两个和尚身高,并用临时变量存储
int tempHeight = height1 > height2 ? height1 : height2;
//比较临时变量和第三个和尚身高,得出最大身高
int maxHeight = tempHeigh > height3 ? tempHeight : height3;
//输出结果
System.out.println("这三个和尚中身高最高的是:" + maxHeigh + "cm");
}
}
04-18
619
01-30
1141
08-11
196