java的基本类型的长度

来源:互联网 发布:台球厅计费软件 编辑:程序博客网 时间:2024/06/01 07:36

byte 1字节

short 2字节

int 4字节

long 8字节

float 4字节

double 8字节

char 2字节

boolean 是平台相关的


Oracle版:This means a boolean is usually a 32-bit variable. However arrays of booleans are treated as arrays of bytes, so booleans are 8 bits in an array"


sun版:可以参看这个文章。System.gc() doesn't guarantee cleaning memory. It just gives an order to the JVM to run the garbage collection, but it doesn't mean that the collector actually cleaned something. 


需要注意的问题是,不管操作系统的位数是多少,基本类型的长度都是固定的。Java程序不是直接运行在本地操作系统上,而是运行在JVM上,JVM将class程序不同的操作系统下的基础类型长度固定。


1 0
原创粉丝点击