Java包装类
1.List对象中只能接收包装类
基本类型会报错
2.包装类有一些方法
如果Boolean
equals方法
比较,hashCode
3.所有包装类都可以将与之对应的基本数据类型作为参数来创建它们的实例对象
4.包含了每种基本数据类型的相关属性,如最大值、最小值、所占位数等
System.out.println(Byte.SIZE); //8
System.out.println(Short.SIZE);//16
System.out.println(Integer.SIZE);//32
System.out.println(Long.SIZE);//64
System.out.println(Float.SIZE);//32
System.out.println(Double.SIZE);//64
System.out.println(Character.SIZE);//16
//自动装箱
int m = 10;
Integer in = m;
System.out.println(in);//10
//自动拆箱
Integer inn = new Integer(10);
int n = inn;
System.out.println(n);//10
声明:以上部分代码转载自https://www.cnblogs.com/Wilange/p/7732236.html