title: How to use values of local variables in inherited functions of java?
body: <p>I have 2 classes A and B such that</p>
  
  <pre><code>public class A {
      public String a = "hey";
  
      public void printA() {
          System.out.println(a);
      }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>public class B extends A{
      public String a = "Jude";
  }
  </code></pre>
  
  <p>What do I need to do so that the output of the lines below is <code>Jude</code></p>
  
  <pre><code>B object = new B();
  object.printA();    //This should output Jude
  </code></pre>