Differences between new Integer(123), Integer.valueOf(123) and just 123
new Integer(123) will create a new Object instance for each call. According to the javadoc, Integer.valueOf(123) has the difference it caches Objects… so you may (or may not) end up with the same Object if you call it more than once. For instance, the following code: public static void main(String[] args) { Integer a = … Read more