java - How many objects are created by using the Integer wrapper class? -
integer = 3; = + 1; integer j = i; j = + j; how many objects created result of statements in sample code above , why? there ide in can see how many objects created (maybe in debug mode)?
the answer, surprisingly, zero.
all integers -128 +127 pre-computed jvm.
your code creates references these existing objects.
Comments
Post a Comment