Thanks to all those that attempted to solve our puzzle. The correct answer is:
output1=true output2=false.
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;
Nikhil Mittra
Ward Coessens
Murali Dharan
Rene Enriquez
Kamlesh Sangani
Jayant Sethi
Turgay Kıvrak
Gurpreet Luthra
Amit Vyas
Gopinath Langote
Dale Fukami
Daniel Tsadok
Erik Kraan
Darrell Grainger
Ivano Pagano
Abhishek Kumar Jha
Carol Bruno
Martin Paulo
Marcelo Schmidt
Ola Bini
Sign up to receive the latest edition of P2 Magazine.