title: Java casting implementation
body: <p>I know how to use casting in Java but have a more specific question; could you please explain to me how the casting works (in memory)?</p>
  
  <ul>
  <li><p>How is the variable type changed upon upcasting and downcasting?</p></li>
  <li><p>How does the JVM know that it's safe to send this method to this object?</p></li>
  </ul>
  
  <p>Thank you in advance.</p>