title: What happen if hascode function is false while equal function is true
body: <p>I am thinking about a question if hashcode function is false but equal function is true, what will happen? For example:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class Demo {
  
      private int age;
  
      private String name;
  
      //getter
      //setter
  
      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
          Demo demo = (Demo) o;
          return age == demo.age &amp;&amp;
                  Objects.equals(name, demo.name);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(age, name)
                  + (new Random().nextInt(1000));
      }
  }
  </code></pre>