1、Java常用的数据类型
分类
数据类型
占用二进制字节
举例
类型默认值
基本数据类型封装类
基本数据类型
(四类八种)
整型
字节型(byte)
8位
byte a = 100
0
Byte
短整型(shot)
16位
short s = 1000
0
Short
整型(int)
32位
int a = 100000
0
Integer
长整型(long)
64位
long a = 100000L
0L
Long
浮点型
单精度(float)
32位
float f1 = 234.5f
0.0f
Float
双精度(double)
64位
double d1 = 123.4
0.0d
Double
字符型
字符型(char)
16位
char letter = 'A'
'u0000'
Character
布尔型
布尔型(boolean)
1位
boolean one = true
false
Boolean
引用数据类型
类
calss
null
接口
interface
null
数组
arr
null
空类型
null
null
PS:黄色标示需要强制转换,蓝色标示自动转换,白色标识不需要转换