What are wrapper classes

What are wrapper classes

A wrapper class is nothing but primitive wrapper class in Java is one of eight classes provided in the java.lang package which are imported by default into all Java programs. All of the primitive wrapper classes in Java are immutable.

JDK 5 introduced autoboxing of primitive types into their wrapper class object, and automatic unboxing of the wrapper objects into their primitive value the implicit conversion between the wrapper objects and primitive values.
The primitive wrapper classes and their corresponding primitive types are shown below:

Wrapper class Primitive type Constructor arguments
byte Byte byte or String
short Short short or String
int Integer int or String
long Long long or String
float Float float, double or String
double Double double or String
char Character char
boolean Boolean boolean or String


Check out all interview questions

Leave a Reply

Your email address will not be published. Required fields are marked *