To make use of the wrapper classes, we need to have means to convert a value of a primitive data type (such as int) to an ``equivalent'' value of the corresponding wrapper class (called boxing), and vice-versa (called unboxing).
Example:
The variable anIntegerObject now references an object of the class Integer that corresponds to the int value 25. Similarly, for the variables aDoubleObject and aCharacterObject.Integer anIntegerObject = new Integer(25); Double aDoubleObject = new Double(3.6); Character aCharacterObject = new Character('A');
Example:
The variable i now contains the value 25, the variable d the value 3.6, and the variable c the value 'A'.int i = anIntegerObject.intValue(); double d = aDoubleObject.doubleValue(); char c = aCharacterObject.charValue();