public class Problem {
public static void main(String args[]){
Integer a=200;
Integer b=200;
Integer c=20;
Integer d=20;
System.out.println(a==b);
System.out.println(a.equals(b));
System.out.println(c==d);
System.out.println(c.equals(d));
}
}
выходсравнить два объекта Integer с == в Java
false
true
true
true
Это так. Не знаю о локальном кеше. кажется удивительным ответом – vikeng21
@ vikeng21 - Да. Это так. проверьте [oracle doc] (http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#valueOf) – TheLostMind