title: if two objects have same hashcode then what about their memory addresses
body: <p>If two objects of the same class have the same hashCode in Java then how would they be stored in a <code>HashMap</code> / <code>HashTable</code>?  What is the actual architecture for hashcode and memory address. Where does hashCode reside in memory?</p>
  
  <p>Example: There is a class <code>A</code>.  when creating objects <code>a1</code> and <code>a2</code> then they will represent some memory address but I overrode hashcode every time same.  When I read an article then I found that hashcode functions generate a hashcode from the memory address. this means the memory address will same if hashcode is same. Please clear my doubt. </p>
  
  <pre><code>public class A {
  
      @Override
      public int hashCode() {
          return 1;
      }
  
      public static void main(String args[]) {
          A a1 = new A();
          A a2 = new A();
          System.out.println(a1.hashCode());
          System.out.println(a2.hashCode());
      }
  }
  </code></pre>