To figure out the difference between int and integer, you need to figure out what the wrapper class is.
Although the Java language is a typical object-oriented programming language, the 8 basic data types do not support object-oriented programming mechanisms, and basic types of data do not have "object" attributes-no attributes, no methods to invoke. They are used only to cater to the deep-rooted habits of human beings and indeed to perform routine data processing in a simple and effective manner. This use of non-object-oriented technology can sometimes be inconvenient, such as reference type data inherit the attributes of the object class, to be converted to string type, as long as simply call the object class defined in the ToString (), and the basic data type is converted to string Type is much more troublesome. To solve this problem, the Java language introduces the concept of encapsulating classes, defining the appropriate reference types for each base data type in the JDK, and calling it a wrapper class (Wrapper Classes).
The following table describes the basic data types and their corresponding wrapper classes:
The difference between int and integer in Java