title: Determine if two Java objects are of the same class
body: <p>I am attempting to do the equivalent of  </p>
  
  <pre><code>if ( object1.class == object2.class )
  {
      //do something
  }  
  </code></pre>
  
  <p>which of course doesn't work, what method am I overlooking?</p>