title: How to compare two java objects
body: <p>I have two java objects that are instantiated from the same class.</p>
  
  <pre><code>MyClass myClass1 = new MyClass();
  MyClass myClass2 = new MyClass();
  </code></pre>
  
  <p>If I set both of their properties to the exact same values and then verify that they are the same</p>
  
  <pre><code>if(myClass1 == myClass2){
     // objects match
     ...
  
  }
  
  if(myClass1.equals(myClass2)){
     // objects match
     ...
  
  }
  </code></pre>
  
  <p>However, neither of these approaches return a true value.  I have checked the properties of each and they match.  </p>
  
  <p>How do I compare these two objects to verify that they are identical?</p>