标签:print static == http div 转换 结果 数据类型转换 类型
1)
1 public class Test01 { 2 3 public static void main(String[] args) { 4 int a = 5; 5 System.out.println("value is " + ((a<5)?10.9:9)); 6 } 7 8 }
输出结果为:9.0
分析:因为有10.9,所以会发生数据类型自动转换,9自动转换为9.0,因此输出结果为9.0.具体数据类型转换详解,请查看本人博客http://www.cnblogs.com/XuGuobao/p/7229881.html
2)
1 public class Test03 { 2 3 public static void main(String[] args) { 4 int m = 5,n = 5; 5 if((m != 5) && (n++ == 5)){} 6 System.out.println("a." +n); 7 8 m = n = 5; 9 if((m != 5) & (n++ == 6)){} 10 System.out.println("b." +n); 11 12 m = n =5; 13 if((m == 5) || (n++ == 5)){} 14 System.out.println("c." +n); 15 16 m = n =5; 17 if((m == 5) | (n++ == 6)){} 18 System.out.println("d." +n); 19 20 int a = 1,b = 2; 21 int c = a & b; 22 System.out.println("a % b" +c); 23 } 24 25 }
输出结果为:
a.5
b.6
c.5
d.6
a % b0
标签:print static == http div 转换 结果 数据类型转换 类型
原文地址:http://www.cnblogs.com/XuGuobao/p/7230752.html