title: Instance variable access by using Inheritance concept
body: <p>I am using a Inheritance concept here. I have extended class A(Superclass) into class B(Subclass). And I have created an object of a subclass and by using that object I have called add() method. But it is printing a value 5(Super Class).
  Why it didn't take subclass's value which is 10 ?</p>
  
  <pre><code>class A{
      int a=5;
  
      public void add(){
          System.out.println(a);
      }
  }
  class B extends A{
      int a=10;
  
  
  }
  public class InheritExample {
  
      public static void main(String args[]){
          B b1=new B();
          b1.add();
      }
  }
  </code></pre>
  
  <p>Help Appreciated.
  Thanks.</p>