It dawned on me! #1 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

It dawned on me! #1

In Java, there is a pool of integers in the interval [-128; 127]. If we create an Integer in this gap, then instead of creating a new object each time, the JVM takes them from the pool. So you can see it clearly in 3 examples below: https://code.sololearn.com/cwnc0SvIt48v/# If you want me to post another interesting things like this, give me a like!

1st Feb 2018, 1:57 PM
Dmitriy Yurkin
Dmitriy Yurkin - avatar
1 Answer
+ 7
nice, thanks for sharing 👍 😃
1st Feb 2018, 4:34 PM
Vukan
Vukan - avatar