从键盘输入三个数,求出最大值
public class Test08 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);
System.out.println("输入第一个数: ");
int a = scanner.nextInt();
System.out.println("输入第二个数: ");
int b = scanner.nextInt();
System.out.println("输入第三个数: ");
int c = scanner.nextInt();
int max1 = a>b?a:b;
int max2 = c>max1?c:max1;
System.out.println("这三个数中最大的是 "+max2);
}
}