title: What does equals(Object obj) do?
body: <p>I´ve often found an equals method in different places. What does it actually do? Is it important that we have to have this in every class?</p>
  
  <pre><code>   public boolean equals(Object obj)
      {
      if (obj == this)
      {
          return true;
      }
      if (obj == null)
      {
          return false;
      }
      if (obj instanceof Contact)
      {
          Contact other = (Contact)obj;
          return other.getFirstName().equals(getFirstName()) &amp;&amp;
                  other.getLastName().equals(getLastName()) &amp;&amp;
                  other.getHomePhone().equals(getHomePhone()) &amp;&amp;
                  other.getCellPhone().equals(getCellPhone());
  
      }
      else
      {
          return false;
      }
  }
  </code></pre>