基本数据类型的包装类
所有的基本数据类型也包括引用类型都有一个class属性
基本数据类型的包装类可以使用基本类型对应的类的相关成员变量和成员方法,相比于基本数据类型,包装类更易于使用。
八大基本数据类型
byte short int long float double char boolean
对应的包装类
Byte Short Integer Long Float Double Character Boolean
Integer包装类
static int MAX_VALUE
值为234—1的常量,它表示int 类型能够表示的最大值。
static int MIN_VALUE
值为-231的常量,它表示int 类型能够给表示的最小值。
static int SIZE
用来以二进制补码形式表示int值的比特位数。
static ClassTYPE
表示基本类型int的Class实例
构造方法
public Integer(int value)
public Integer(String s)
成员方法
public int intValue() 拆箱,将Integer转化为整型
public static int parseInt(String s) 将字符串转换为int类型
public static String toString(int i) 将整型转换为字符串
public static Integer valueOf(int i) 将整型装换为Integer类型
public static Integer valueOf(String s) 将字符串转换为Integer类型