title: Why does the inherited method use not redefined variable?
body: <p>Why does the inherited method <code>show_hp()</code> of the class Knight doesn't use the class's variable hp, which was redefined in lower-in-hierarchy subclass?</p>
  
  <p>I've tried overriding the method <code>show_hp()</code> and it worked, but I'm missing the concept of polymorphism, I think.</p>
  
  <pre><code>public class scratch {
  
      public static void main(String[] args) {
              Knight Ricardo = new Knight();
              Ricardo.show_hp();
          }
  
  
      static class Hero {
          int hp = 5;
  
          public void show_hp() {
              System.out.println(" I have " + hp + " hp!");
          }
      }
  
  
      static class Knight extends Hero {
          int hp = 3;
      }
  }
  </code></pre>
  
  <p>I expect the output of 3, but the actual one is 5.</p>