Everything in Java is an object, because there are basic data types.
Basic data types have a corresponding base data Type Packager, and their base data Type Packager is an object.
J2SE 5.0 introduces boxing and unboxing, which are the relationship between the basic data type and the basic data Type Packager
Long and long
Long's inheritance relationship:
A few messages:
1, long by final modification, not variable
2. Parent class is abstract class number
3, realize the comparable interface, can be compared
public static long valueOf (long L)
Document translation:
Returns a long instance that represents the specified long value. If you do not need a new long instance, you should usually prefer this method instead of a long (long) constructor.
Because this method can generate significantly better spatial and temporal performance by caching frequently requested values. Note that unlike the corresponding methods in the integer class, this method does not need to cache values in a specific range.
Source:
public static Integer valueOf (int i)
Document Translation :
Returns an integer instance that represents the specified int value. If you do not need a new integer instance, you should usually prefer this method instead of the constructor integer (int).
This method can produce significantly better spatial and temporal performance by caching frequently requested values. This method will always cache values from 128 to 127 (inclusive) , and can cache other values outside of this range .
Ingeger and int:
An integer inheritance relationship:
Similar to Long
integer.valueof (int i) can be cached outside the range, you can change the upper limit by the command line, but the lower limit cannot be changed, the source code is reflected:
Note
Debug is one of the best tools to understand the source code.
Java--long and Long/integer and long