基本类型包装类的成员都是被static修饰的,所以可以通过类名直接进行访问
装箱:基本数据类型转换为对应的引用数据类型(包装类类型)
拆箱:将对应的引用数据类型(包装类类型)转换为基本数据类型
int--Integer
char--Character
boolean--Boolean
float--Float
double--Double
long--Long
short--Short
byte--Byte
基本数据类型对应的引用数据类型
常见操作int和String的相互转换:
1.利用String类的方法valueOf(int i)
2.利用Integer类的方法intValue()将Integer类型的转换为int类型
3.利用Integer类的方法paeseInt(String s)将String类型的值转换为int类型
型,是Integer类的方法
integer类方法:
public Integer(int value):根据int 值创建Integer对象(过时)
public Integer(String s) :根据String值创建Integer对象(过时)
public static Integer valueOf(int i):返回表示指定的int的Integer实例
public static Intger valueOf(String s) :返回一个保存指定值的Integer对象String
Integer成员:
public static final int MAX_VALUE:int范围的最大值
public statci final int MIN_VALUE:int范围的最小值
public int intValue():返回一个Integer作为int的值
public static int parseInt(String s):将字符串转换为int类型,是Integer类的方法