SiteMap  | About    

What are wrapper classes?

As the name says, a wrapper class wraps (encloses) around a data type and gives it an object appearance. They are used to convert any primitive type into an object. The primitive data types are not objects; they do not belong to any class; they are defined in the language itself. Sometimes, it is required to convert data types into objects in Java language. For example, while storing in data structures which support only objects, it is required to convert the primitive type to object first, so we go for wrapper class.


The int data type i is converted into an object, iWrap using Integer class. The iWrap object can be used in Java programming wherever i is required an object.

When you want to convert back (unwrap) to primitive type you can use intValue() of Integer class.

intValue() is a method of Integer class that returns an int data type. (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.