O'Reilly logo

PURE Java™ 2 by Kenneth Litwak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Table 4.1. Java's Primitive Data Types
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. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required