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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -