int --Integer(类) char--Character double--Double float=Float 其他的类似

创建Integer类: Integer a=new Integer(3); Integer b=Integer.valueOf(3);

把包装类对象转换成基本数据类型: int c=b; int c=b.intValue(); double d=b.doubleValue();

把字符串对象转换成包装对象: int c=new Integer("1234") int c=Integer.parseInt("1234")

包装对象转换成字符串: String s=c.toString(); String s=""+c; (空格)

Integer缓存范围[-128,127] 在整个区间内,不同对象如果赋相同值,则对象一样,超过区间则不一样 缓存就是数组,该数组包含了-128到127之间的对象,如果创建的对象没超过则从数组内取,如果超过了就new一个,所以对象会不同 例子: Integer a=123; Integer b=123; System.out.println(a==b); System.out.println(a.equals(b)); true true

Integer a=1234; Integer b=1234; System.out.println(a==b); System.out.println(a.equals(b)); false true