package oop;
//定义三个int型变量并赋值,使用三元运算符和if-else获取这三个数中的较大数的实现
public class compore {
public static void main(String[] args) {
int a = 3, b = 9, c = 15;
int max;
//三元运算符比较
max = a > b ? a : b;
max = max > c ? max : c;
System.out.println(max);
//if语句比较
if(a > b) {
if(a > c) {
System.out.println(a);
}else {
System.out.println(c);
}
}else if(b > c){
System.out.println(b);
}else {
System.out.println(c);
}
}
}