Javatpoint Logo

91-9990449935

 0120-4256464

Javatpoint Logo

Wrapper class in Java

Wrapper class in java provides the mechanism to convert primitive into object and object into primitive.

Since J2SE 5.0, autoboxing and unboxing feature converts primitive into object and object into primitive automatically. The automatic conversion of primitive into object is known as autoboxing and vice-versa unboxing.

The eight classes of java.lang package are known as wrapper classes in java. The list of eight wrapper classes are given below:

Primitive TypeWrapper class
booleanBoolean
charCharacter
byteByte
shortShort
intInteger
longLong
floatFloat
doubleDouble

Wrapper class Example: Primitive to Wrapper

Output:

20 20 20

Wrapper class Example: Wrapper to Primitive

Output:

3 3 3




Share this page

facebook twitter google plus pinterest tumbler

Latest 4 Tutorials