$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · hard · #233

What is the output?

Integer a = 127, b = 127;
Integer c = 128, d = 128;
System.out.println((a == b) + " " + (c == d));
  1. true true
  2. false false
  3. false true
  4. true false
Autoboxing caches Integer values from -128 to 127, so == compares the same object only for 127.
Play Problem Solving ▸