Java 8 种数据类型 字节大小

原文出处 博客地址 http://blog.csdn.net/never_cxb https://blog.csdn.net/never_cxb/article/details/47204485

类型 大小
int 4个字节
char 2个字节
byte 1个字节
short 2个字节
long 8个字节
float 4个字节
double 8个字节

关于boolean占几个字节,众说纷纭,虽然boolean表现出非0即1的“位”特性,但是存储空间的基本计量单位是字节,不是位。所以boolean至少占一个字节。 
JVM规范中,boolean变量作为int处理,也就是4字节;boolean数组当做byte数组处理。

猜你喜欢

转载自blog.csdn.net/qq_29611427/article/details/81981111
今日推荐