Java数据类型(type)可以分为两大类:基本类型(primitive types)和引用类型(reference types)。
基本类型(primitive types) 包括boolean类型以及数值类型(numeric types)。
numeric types又分为整型(integer types)和浮点型(floating-point type)。
下列表格大体上规划的数据类型:
primitive |
numeric |
integer |
byte |
8bit |
[-27,27-1] |
short |
16bit |
[-215,215-1] | |||
int |
32bit |
[-231,231-1] | |||
long |
64bit |
[-263,263-1] | |||
floating-point |
float |
32bit |
1.最小正标准值的常量,即 2-126 2.最小正非零值的常量,即 2-149 3.最大正有限值的常量,即 (2-2-23)·2127 | ||
double |
64bit |
1.最小正标准值的常量,即 2-1022 2.最小正非零值的常量,即 2-1074 3.最大正有限值的常量,即 (2-2-52)·21023 | |||
boolean |
|
|
|
true false | |
char |
|
|
|
[0, 65535] | |
void |
|
|
|
| |
reference |
class type |
|
|
|
|
interface type |
|
|
|
| |
array type |
|
|
|
| |
null type |
|
|
|
|