
Primitive wrapper classes (Integer, Long, Short, Char, Float, Double in java.lang)
Not all APIs on the Java platform can work with a JVM's built-in primitive datatypes. When passing a primitive datatype variable, if a primitive wrapper class is required, compilers that support this technique will automatically create an instance of the corresponding wrapper class. The reverse of this situation is also true: when a primitive variable is required and a wrapper object is assigned to it, then the compiler will automatically assign the value of the wrapper class to the primitive variable. This process is called autoboxing.
Like the String class, all these classes are immutable. When you call methods that modify a value, a new instance is created and returned with the new value.
As mentioned in the previous chapter, some JVM languages follow the "everything is an object" object-orientated programming rule and do not support the creation of primitive datatypes. These languages also use wrapper classes when primitive values are used.