title: java - How do I check if my object is of type of a given class?
body: <p>My method gets Class as a parameter and I have to check that one my variables is of type class.</p>
  
  <pre><code>Volvo v1 = new Volvo();
  Class aClass = v1.getClass();
  check(aClass);
  </code></pre>
  
  <p>inside I need to do something like  </p>
  
  <pre><code>   v2 instanceof aClass  ? "True" : "False");
  </code></pre>
  
  <p>but this doesn;t compile .</p>