package Code428; import java.util.Scanner; public class CodeScannerMax { public static void main(String[] args) {
//从键盘输入三个数字
Scanner scanner =new Scanner(System.in);
int a=scanner.nextInt();
int b=scanner.nextInt();
int c =scanner.nextInt();
//使用三元运算符 a大于b,如果大于则 temp=a,否则temp=b;
int temp = a>b?a:b;
int max = c>temp?c:temp;
System.out.println("最大值"+max);
}
}
运行代码↓