Primitives
There are eight kinds of primitives. There are two numeric groups, floating point and integer, plus boolean. These could have been created as classes (as in Smalltalk), but not doing so was an optimization made for better performance. Because primitives are used so often, making them objects would greatly degrade performance. The primitive data types are shown in Table 4.1.
Primitive | Description |
---|---|
byte | One byte long, signed value. |
short | Two-byte long, signed value. |
int | Four-byte long, signed value. This is Java's main primitive for doing integral arithmetic. |
long | Eight-byte long, signed value. |
float | Four-byte long, signed floating point value. |
double | Eight-byte long, signed floating point value. ... |
Get PURE Java™ 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.