Wrapper Classes
Wrapper classes are used to encapsulate primitive types so that you can define them against them. For example, the ToString () method is defined in a wrapper class, but it cannot be called in a primitive type.
Autoboxing
Autoboxing allows you to automatically convert between primitive types and cover types
With auto boxing
int i; Integer j; i = 1; j = 2; i = j; j = i;
No Auto Boxing
int i; Integer j; i = 1; j = new Integer(2); i = j.intValue(); j = new Integer(i)
About the second section of the question
Object [] anArray = new Object[20];
A certain array is capable of objects (in a particular case, it is 20 objects), so it allows you to hold any object in each position of the array,
anArray[0] = new Integer (37);
and Integer is a subclass of Object. Thus, it allows you to store Integer in an array
source share