package chapter05;
import java.util.Scanner;
public class Test08 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入三个进行比较的数字:");
int a = sc.nextInt();
int b = sc.nextInt();
int d = sc.nextInt();
int c = egg(a, b, d);
sc.close();
System.out.println("三个数值的最大值为:" + c);
}
public static int egg(int a, int b, int d) {
int max = a > b ? a : b;
max = max > d ? max : d;
return max;
}
}
运行结果: