1、byte
1字节,-2^7~2^7-1
2、short
2字节,-2^15~2^15-1
3、int
4字节,-2^31~2^31-1
4、long
8字节,-2^63~2^63-1
5、float
4字节,3.402823e+38~1.401298e-45(e+38,为10的38次方)
6、double
8字节,1.797693e+308~4.9000000e-234
7、char
2字节,0~2^16-1
8、boolean
取值是true或false
本文详细介绍了Java中各种基本数据类型的存储范围,包括byte、short、int、long、float、double、char及boolean等,为开发者提供了一目了然的数据类型选择指南。
1、byte
1字节,-2^7~2^7-1
2、short
2字节,-2^15~2^15-1
3、int
4字节,-2^31~2^31-1
4、long
8字节,-2^63~2^63-1
5、float
4字节,3.402823e+38~1.401298e-45(e+38,为10的38次方)
6、double
8字节,1.797693e+308~4.9000000e-234
7、char
2字节,0~2^16-1
8、boolean
取值是true或false
5144

被折叠的 条评论
为什么被折叠?