Thanks to all those that attempted to solve our puzzle. The correct answer is:
This is because the Integer class in Java caches values between -128 to 127. Anything between these range it will reference the same object.
A big thank you goes out to all of our puzzle entrants. The randomly-chosen winner of this issue’s prize was Paul Sideleau and he will receive a ThoughtWorks book of his choice.
Here’s a list of all the other people who answered correctly;
Abhishek Kumar Jha
Sign up to receive the latest edition of P2 Magazine.