The ourput of current program is "Strange". But the both the variables share the same reference why are second and thrid comparison not true.
Integer a;
Integer b;
a = new Integer(2);
b = a;
if(b == a) {
System.out.println("Strange");
}
a++;
if(b == a) {
System.out.println("Stranger");
}
a--;
if(b == a) {
System.out.println("Strangest");
}
Output: Strange