title: using a static variable in hashCode()
body: <p>When overriding the <code>equals()</code> and <code>hashCode()</code> methods of a class, would the following approach work?</p>
  
  <p>All my logic to see if the objects are equal is done in my <code>equals()</code> method. The class has a static variable (we'll call it <code>hashCodeReturn</code>) that is set to 1.</p>
  
  <p>When ever the equals method reaches logic that would return false, it adds 1 to <code>hashCodeReturn</code></p>
  
  <p>The <code>hashCode()</code> then simply returns the <code>hashCodeReturn</code> value</p>
  
  <p>Is there any reason this would not work?</p>
  
  <p>Many thanks.</p>