(ternary operator)三元运算符.

ternary operator:

  advantage:

    make a terse simple conditional assignment statement of if-then-else.

  disadvantage:

    if must contains return type,for instance,the code below compiles error.

 int a = 2 > 1 ? Print.println("2 > 1") : 1;
//compile error.
上一篇:source insight技巧


下一篇:CSS3总结学习(一):CSS3用户界面