title: How to implement hashCode and equals method
body: <p>How should I implement <code>hashCode()</code> and <code>equals()</code> for the following class in Java?</p>
  
  <pre><code>class Emp 
  {
    int empid ; // unique across all the departments 
    String name;
    String dept_name ;
    String code ; // unique for the department 
  }
  </code></pre>