intermediatePremium

The Integer Cache Trap

Why == lies for boxed values

The Integer Cache Trap

Autoboxing caches -128..127. == compares object references, so two equal Integers can be unequal.

The narrated version of this skribble — tap play for the full-size video.

2:01

The Integer Cache Trap

Premium
🔒

Premium skribble

The preview above is intentionally blurred. Unlock the full-resolution skribble — and its deep-dive board — with TechSkribble.

Unlock this course Already purchased? Sign in
#java#gotchas#autoboxing#equality