Chapter 3. Primitive Types, Wrappers, and Boxing

  • Literal Values

  • Boolean

  • Char

  • INT

  • Long

  • Byte

  • Short

  • Limited Accuracy of Floating Point Types

  • Double

  • Float

  • Object Wrappers for Primitives

  • Autoboxing and Unboxing

  • Performance Implications of Autoboxing

  • Java.lang.Object

  • Java.lang.String

  • Language Support for String Concatenation

  • String Comparison

  • Some Light Relief—Hatless Atlas

There are eight built-in, non-object types in Java, known as primitive types. Every piece of data in a class is ultimately represented in terms of these primitive types. The eight primitive types are:

  • boolean (for true/false values)

  • char (for character data, ultimately to be input or printed)

  • int, long, byte, short (for arithmetic on whole numbers) ...

Get Just 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.