/** * Created by xabcd on 2019/2/12. */ public class TestJava6_13 {public static void main(String args[]) { boolean t = (1+1 ==2)? true: false; System.out.println("1+1 ==2:" +t); } //a?x:y,若a为非0,则表达式值为x否则为y } 结果: 1+1 ==2:true
/** * Created by xabcd on 2019/2/12. */ public class TestJava6_13 {public static void main(String args[]) { boolean t = (1+1 ==2)? true: false; System.out.println("1+1 ==2:" +t); } //a?x:y,若a为非0,则表达式值为x否则为y } 结果: 1+1 ==2:true