title: How == and equal works in java in Case of Integer Object?
body: <p>I have found many possible duplicates question on this but none clarifies my doubt on how it works?</p>
  
  <pre><code>    Integer a =25654; // a.hashCode()=&gt;25654
      Integer b =25654; // b.hashCode()=&gt;25654
      System.out.println(a.equals(b)); =&gt; true
      System.out.println(a == b);   =&gt; false
  </code></pre>
  
  <p>I have read this answer somewhere..</p>
  
  <blockquote>
    <p>If no parent classes have provided an override, then it defaults to the method from the ultimate parent class, Object, and so you're left with the Object#equals(Object o) method. Per the Object API this is the same as ==; that is, it returns true if and only if both variables refer to the same object, if their references are one and the same. Thus you will be testing for object equality and not functional equality.</p>
  </blockquote>
  
  <p>in this case both object have same memory address(as per hashcode) still why does it returns false when we compare using == ? or the actual memory address is different? please correct me if i am wrong. Thanks</p>