title: employee.hashCode() Vs employee.getClass().hashcode() in Java
body: <p>I have below program.</p>
  
  <pre><code>Employee employee1 = new Employee("Raghav1", 101);
  
  Employee employee2 = new Employee("Raghav", 100);
  
  // #1
  System.out.println(employee1.hashCode() == employee2.hashCode()); 
  
  // #2
  System.out.println(employee1.getClass().hashCode() == employee2.getClass().hashCode());
  </code></pre>
  
  <p>The statement 1 returns <code>false</code> as both employee objects are different but why  the statement 2 returns <code>true</code>.</p>
  
  <p>Can anyone explain the difference between the above statements?</p>