包装类

2020-07-11  本文已影响0人  xueyueshuai
包装类和基本数据类型的关系
基本数据类型                       包装类

byte                                                          Byte           

boolean                                                    Boolean     

short                                                         Short          

char                                                          Character   

int                                                             Integer        

long                                                           Long          

float                                                          Float           

double                                                     Double    
我们已经知道,Java的数据类型分两种:

基本类型:byte,short,int,long,boolean,float,double,char

引用类型:所有class和interface类型

引用类型可以赋值为null,表示空,但基本类型不能赋值为null:

String s = null;
int n = null; // compile error!
上一篇 下一篇

猜你喜欢

热点阅读