Tagged articles

integer cache

6 articles · Page 1 of 1
Java Tech Workshop
Java Tech Workshop
Apr 30, 2026 · Fundamentals

Do You Really Understand the Difference Between == and equals() in Java?

This article explains how == compares primitive values and object references, why Object.equals() defaults to ==, how classes like String and Integer override equals(), the impact of the string constant pool, integer caching, auto‑boxing, floating‑point pitfalls, and best practices for correctly comparing objects in Java.

==InterviewJava
0 likes · 16 min read
Do You Really Understand the Difference Between == and equals() in Java?
DevOps Coach
DevOps Coach
Dec 27, 2025 · Fundamentals

Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache

The article explains why comparing two Integer objects with `==` returns true for values within -128 to 127 but false for larger numbers, detailing Java’s integer cache, reference vs. value equality, and the correct use of `.equals()` to avoid subtle bugs.

JavaReference Equalityautoboxing
0 likes · 6 min read
Why Does Integer == Fail for 128? Unveiling Java’s Autoboxing Cache
Programmer DD
Programmer DD
Sep 16, 2020 · Backend Development

Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache

This article explains why the == operator returns true for small Integer values in Java, detailing the internal IntegerCache mechanism, demonstrating the behavior with code examples, and showing how reflection can manipulate the cache, highlighting both the benefits and potential pitfalls of this optimization.

Reference EqualityReflectionautoboxing
0 likes · 4 min read
Why Does Integer == Return True for Small Numbers? Uncover Java’s Integer Cache