- 包装类型
- 基本类型:
byte,short,int,long,boolean,float,double,char;
- 引用类型:所有
class和interface类型。
null,表示空,但基本类型不能赋值为null:String s = null; int n = null; // compile error!
int基本类型变成一个引用类型,我们可以定义一个Integer类,它只包含一个实例字段int,这样,Integer类就可以视为int的包装类(Wrapper Class):