| Type | Signed? | Bits | Bytes | Lowest | Highest |
|---|---|---|---|---|---|
| boolean | n/a | 1 | 1 | false | true |
| byte | signed | 8 | 1 | -27 -128 |
27-1 +127 |
| char | unsigned Unicode | 16 | 2 | 0 '\u0000' |
216-1 '\uffff' |
| short | signed | 16 | 2 | -215 -32,768 |
215-1 32,767 |
| int | signed | 32 | 4 | -231 -2,147,483,648 Integer.MIN_VALUE |
231-1 2,147,483,647 Integer.MAX_VALUE |
| float | signed exponent and mantissa | 32 | 4 | ±1.40129846432481707e-45 | ±3.40282346638528860e+38 with 6 to 7 significant digits of accuracy. |
| long | signed | 64 | 8 | -263 -9,223,372,036,854,775,808 Long.MIN_VALUE |
263-1 9,223,372,036,854,775,807 Long.MAX_VALUE |
| double | signed exponent and mantissa | 64 | 8 | ±4.94065645841246544e-324 | ±1.79769313486231570e+308 with 14 to 15 significant digits of accuracy. |
Java defines the following object wrappers for primitives:
| Mutable Primitives | Immutable Objects |
|---|---|
| boolean | Boolean |
| ordinary signed byte | Byte |
| unsigned byte | Byte |
| short | Short |
| char | Character |
| int | Integer |
| long | Long |
| float | Float |
| double | Double |
| char | String |
Float and Double classes also define: NaN, NEGATIVE_INFINITY and
POSITIVE_INFINITY
| Revisions | |
| 03/31/2003 | Formatting, cleanup, added note about Float and Double classes. |