Case: Three monks (upgraded version)
import java.util.Scanner;
public class HelloWorld {
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+"cm");
}
}