标签:
|
1
2
3
4
5
|
byte b1=1,b2=2,b3,b6; final byte b4=4,b5=6; b6=b4+b5; b3=(b1+b2); System.out.println(b3+b6); |
分析:
表达式的数据类型自动提升, 关于类型的自动提升,注意下面的规则。
①所有的byte,short,char型的值将被提升为int型;
②如果有一个操作数是long型,计算结果是long型;
③如果有一个操作数是float型,计算结果是float型;
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public class Test{ public int add(int a,int b){ try { return a+b; } catch (Exception e) { System.out.println("catch语句块"); } finally{ System.out.println("finally语句块"); } return 0; } public static void main(String argv[]){ Test test =new Test(); System.out.println("和是:"+test.add(9, 34)); }} |
分析:
|
1
2
3
4
|
java.util.HashMap map=new java.util.HashMap(); map.put("name",null); map.put("name","Jack");System.out.println(map.size()); |
标签:
原文地址:http://www.cnblogs.com/xuan52rock/p/4759936.html