Community

Java Integer Cache – Why Integer.valueOf(127) == Integer.valueOf(127) Is True

(Naresh Joshi) In an interview, one of my friends was asked that if we have two Integer objects, Integer a = 127; Integer b = 127; Why a == b evaluate to true when both are holding two separate objects?




Facebooktwittergoogle_plusredditpinterestlinkedinmail