A class that contains the primitive data types is known as a Wrapper class. It provides a way to use primitive data types as objects. An object is required to support synchronization in multi-threading, serialization and useful in the collection framework. Following are the eight wrapper classes given below –
Primitive data type | Wrapper class |
---|---|
int | Integer |
char | Char |
byte | Byte |
short | Short |
long | Long |
float | Float |
double | Double |
boolean | Boolean |
In this section, the below-mentioned topics we will be covered:
- Autoboxing & Unboxing
- Typecasting