by Dinesh Thakur

Elements that can be added to the Vector must be of type java .lang. Object. In other words, vectors cannot handle primitive data typeslike int, float, char and double as they are not objects. So in order to work with primitive typevariables as if they were objects, Java provides class for each of the primitive types. These classesare known as wrapper classes.

A wrapper class wraps the value of a primitive type such as int or double into an object of that class. The Wrapper classes are part of java.lang package which is imported by default into all Java programs. These wrapper classes define an instance variable of that primitive data type and also provides useful constants and methods for conversion between the primitive data types and the objects. 

public class IntWrapperClass

      public static void main(String[] args)
         int a=35;
         Integer aObject=new Integer(a);
         System.out.println("Maximum value of integer is : "+Integer.MAX_VALUE);
         System.out.println("Maximum value of integer is  : "+Integer.MIN_VALUE);
          System.out.println("Integer.parseInt(\"1245\") : "+Integer.parseInt("1245"));
          System.out.println("aObject.intValue() : "+aObject.intValue());
          System.out.println("aObject.toString() : "+aObject.toString());
          Integer Obj=Integer.valueOf("11010",2);
          System.out.println("Obj.inValue() : "+Obj.intValue());

Wrapper Class in Java With Example