Integer is a (wrapper) class name and so the variables of this type are objects. When x is assigned the value of new Integer(5) then, ethically, you cannot use x directly for mathematical operations. To use x in operations, you have to use the wrapper class method intValue() to get x's value in numeric (primitive) form from object form.

However, using x directly in mathematical ops would not produce an error and, in fact, will produce the same output as going through the above step will. This is because the JVM implicitly converts the object to primitive data value and this process is called Auto boxing. The inverse, when implicitly done, is called Un-boxing. Therefore, in the above example, you can also do this: