Skip to main content

Practice ยท 3 of 3

Predict the Box Comparison

Without running code first, predict each result, then implement Solution.answers() returning them as a boolean[]: 1. Integer a = 1000, b = 1000; a == b โ€” ? 2. Integer c = 100, d = 100; c == d โ€” ? 3. Integer e = 1000, f = 1000; e.equals(f) โ€” ? 4. int g = 1000; Integer h = 1000; g == h โ€” ? (unboxing comparison) Index 0..3 in the returned array. Then read the explanation the tests give you and reconcile it with your intuition.

Difficulty: intermediate

Back to lesson: Practice: Contract Lab