title: How to change an object type in java
body: <p>I am trying to change an object to another similar object.
  Both objects are sub classes of the class Player it is originally type Human and I am trying to change it to type EasyCompAI it remains type Human. When i initialize p2 it is Player p2= new Human(); which is OK. I Tried:</p>
  
  <pre><code>Player p2=new Human(2,'2');
  p2 = null; 
  p2 = new EasyCompAI(2, '2');
  </code></pre>
  
  <p>but when I do </p>
  
  <pre><code>gui.getBoardPanel().getP2().getClass();
  </code></pre>
  
  <p>I get Human</p>
  
  <p>thank you for your time and help if more context is needed I will gladly add more. </p>