java中的三元运算符

  • 格式:

关系表达式 ? 表达式1:表达式2

public class OperatorDemo {
    public static void main(String[] args){
        int a = 10;
        int b = 20;
        int c = a>b ? a:b;
        System.out.println(c);
    }
}
原文地址:https://www.cnblogs.com/chichung/p/10150837.html