基本数据类型 | 大小 | 包装类 |
---|---|---|
boolean | 1/8(1bit) | Boolean |
byte | 1 | Byte |
char | 2 | Character |
short | 2 | Short |
int | 4 | Integer |
float | 4 | Float |
long | 8 | Long |
double | 8 | Double |
public static void main(String[] args){
System.out.println(Byte.SIZE/8);
System.out.println(Character.SIZE/8);
System.out.println(Short.SIZE/8);
System.out.println(Integer.SIZE/8);
System.out.println(Float.SIZE/8);
System.out.println(Long.SIZE/8);
System.out.println(Double.SIZE/8);
}
上面的代码运行结果:1 2 2 4 4 8 8
详情见官方文档
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html