J.3. Type-Wrapper Classes for Primitive Types

Each primitive type (listed in Appendix L) has a corresponding type-wrapper class in package java.lang. These classes are called Boolean, Byte, Character, Double, Float, Integer, Long and Short. These enable you to manipulate primitive-type values as objects. Java’s reusable data structures manipulate and share objects—they cannot manipulate variables of primitive types. However, they can manipulate objects of the type-wrapper classes, because every class ultimately derives from Object.

Each of the numeric type-wrapper classes—Byte, Short, Integer, Long, Float and Double—extends class Number. Also, the type-wrapper classes are final classes, so you cannot extend them.

Primitive types do not have ...

Get Android™ How to Program, Second Edition 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.