Every Java primitive type has a corresponding class defined in the Java API class library.
This class is sometimes called a wrapper class because it wraps a primitive value with the object-oriented equivalent to make the primitive type look and behave like an object.
The following table lists the wrapper classes for each of the eight primitive types.
| Primitive Type | Wrapper Class |
|---|---|
| int | Integer |
| short | Short |
| long | Long |
| byte | Byte |
| float | Float |
| double | Double |
| char | Character |
| boolean | Boolean |
You can use these wrapper classes to convert primitive values to strings, and vice versa.
PreviousNext