System.out.println(Integer.valueOf(5) == Integer.valueOf(5)); System.out.println(Integer.valueOf(500) == Integer.valueOf(500)); The output is
true false Why does the first line returns true but the second line returns false? What's the trick here since both are calling valueOf() on Integer class.