public class IntegerVsInt {
    public static void main(String args[])
    {
        int a = 1;
        int b = 1;
        int c = a + b;
        System.out.println(c);
        System.out.println(a == b);
        Integer x = 1;
        Integer y = 1;
        Integer z = x + y;
        System.out.println(z);
        System.out.println(x == y);
    }
}
In the above code I am comparing two int's and two objects of type integer.
When you compare two int's
a == b
I would expect their values to be compared.
However when you compare two Integer's
x == y
I would expect the address of the two object to be compared and then return a false.
I get true in both the cases? Why is this behavior?
 
     
     
    