In j2se 1.5 autoboxing was introduced which automatically converts the
int value "2" to an Integer object in this statement.
Before j2se 1.5 this would have caused a compile error.
Integer is a wrapper class that wraps the primitive
int value and makes it an Object for use where objects are required such as for use in the interface Comparable or for Collection interface implementations, eg, ArrayList.
For more see
The Numbers Classes.