Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaInteger caching identitySingle-choice MCQ

Look at this code on a standard HotSpot JVM with default settings. What does it print, and why?

Integer a = 127, b = 127; Integer c = 128, d = 128; System.out.println(a == b); System.out.println(c == d);