title: What is the difference between instanceof and Class.isAssignableFrom(...)?
body: <p>Which of the following is better?</p>
  
  <pre><code>a instanceof B
  </code></pre>
  
  <p>or</p>
  
  <pre><code>B.class.isAssignableFrom(a.getClass())
  </code></pre>
  
  <p>The only difference that I know of is, when 'a' is null, the first returns false, while the second throws an exception. Other than that, do they always give the same result?</p>