title: What is the 'instanceof' operator used for in Java?
body: <p>What is the <code>instanceof</code> operator used for? I've seen stuff like</p>
  
  <pre><code>if (source instanceof Button) {
      //...
  } else {
      //...
  }
  </code></pre>
  
  <p>But none of it made sense to me. I've done my research, but came up only with examples without any explanations.</p>