首页 > 其他 > 详细

(ternary operator)三元运算符.

时间:2014-03-04 19:05:10      阅读:458      评论:0      收藏:0      [点我收藏+]

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.

bubuko.com,布布扣
1 int a = 2 > 1 ? Print.println("2 > 1") : 1;
2 //compile error.
bubuko.com,布布扣

(ternary operator)三元运算符.,布布扣,bubuko.com

(ternary operator)三元运算符.

原文:http://www.cnblogs.com/listened/p/3579577.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!