4类8种
整数型:byte、int、short、long
浮点型:float、double
字符型:char
布尔型:boolean
byte 1Byte -128-127
short 2B
int 4B
long 8Byte -2^63 ~ 2^63-1
float 4B
double 8B
char 2B
boolean 1Byte
注意:
浮点只是近似值,无法表示1/3
浮点类型默认是double,使用float,加f,1.2f
字符串是引用类型
4类8种
整数型:byte、int、short、long
浮点型:float、double
字符型:char
布尔型:boolean
byte 1Byte -128-127
short 2B
int 4B
long 8Byte -2^63 ~ 2^63-1
float 4B
double 8B
char 2B
boolean 1Byte
注意:
浮点只是近似值,无法表示1/3
浮点类型默认是double,使用float,加f,1.2f
字符串是引用类型