Integer a = 10 invokes java when Integer.valueOf () method as a packing a Integer object.
PS: packing time, if the two values are equal Integer, and the range of -128 to 127, the cache starts IntegerCache return the same object
when the new new Integer Integer () int variable is compared with the target time will be called the Integer intValue () method for automatically unpacking to an int compare!
Thus Integer i = null value when the int "== "comparison of the time, will be reported NPE.
java Integer packing and unpacking
Guess you like
Origin blog.csdn.net/hu1991514/article/details/104772063
Ranking