三元表达式类型提升

1 public static void method6()
2 {
3     char x = 'X';
4     int i = 0;
5     System.out.println(true ? x : 0);//X
6     System.out.println(false ? i : x);//88
7 }

 

posted @ 2014-02-14 10:10  一路向北中  阅读(158)  评论(0)    收藏  举报