Java supports a complete set of primitive data types, listed
in Table 13.1.
In Java, the size of each type is defined by the language,
and is not implementation dependent, as it is in C.
Table 13.1: Java Primitive Data Types
|
|
|
|
Min Value |
Type |
Contains |
Default |
Size |
Max Value |
boolean |
true or false |
false |
1 bit |
N.A. |
|
|
|
|
N.A. |
char |
Unicode character |
\u0000 |
16 bits |
\u0000 |
|
|
|
|
\uFFFF |
byte |
signed integer |
0 |
8 bits |
-128 |
|
|
|
|
127 |
short |
signed integer |
0 |
16 bits |
-32768 |
|
|
|
|
32767 |
int |
signed integer |
0 |
32 bits |
-2147483648 |
|
|
|
|
2147483647 |
long |
signed integer |
0 |
64 bits |
-9223372036854775808 |
|
|
|
|
9223372036854775807 |
float |
IEEE 754 |
0.0 |
32 bits |
+/-3.40282347E+38 |
|
floating-point |
|
|
+/-1.40239846E-45 |
double |
IEEE 754 |
0.0 |
64 bits |
+/-1.79769313486231570E+308 |
|
floating-point |
|
|
+/-4.94065645841246544E-324 |