title: Java isInstance vs instanceOf operator
body: <p>The whole generics thing is kinda throwing me for a loop, and more so the RTT.</p>
  
  <p>Specificis?  Ah well here's the gist:</p>
  
  <pre><code>enum QueryHelper {
    query1,
    query2;
    static &lt;T&gt; QueryHelper getQueryHelper (Class&lt;T&gt; expectedReturn) {
      if (expectedReturn.isInstance (SomeRelatedClass.class))
        return query1;
      else
        return query2;
    }
  }
  </code></pre>
  
  <p>and then I would call it like so: </p>
  
  <pre><code>...
  QueryHelper helper = QueryHelper.getQueryHelper(SomeRelatedClass.class);
  ...
  </code></pre>
  
  <p>This is so that I can really flexibly assign the query return type in the actual helper.   It does some casting and object creation.  What I am seeing is that there is no match, should I be doing this some other way?  Or is the whole idea just bad?</p>
  
  <p>And the real heart of this is that I don't understand the difference between class.isInstance and the instanceOf operator?  Should I be using the latter? </p>