import java.util.Scanner;//Scanner首字母要大写
public class ScannerText{
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 = tempHeight > height3 ? tempHeight : height3;
System.out.println("maxHeight:" + maxHeight);
}
}
【Java】一座寺庙里住着三个和尚,他们的身高必须经过测量得出,请用程序实现获取这三个和尚的最高身高
于 2022-03-27 19:07:23 首次发布