title: why am i not able to change the value of an variable of the parent class using a constructor in the child class?
body: <pre><code>class Parent{
      int a ;
      
      Parent(){
          
      }
      
      public int getA() {
          return a;
      }
      
      Parent(int c){
          this.a=c;
          System.out.println(&quot;I AM IN Parent AND THE VALUE OF a is : &quot;+a);
          
      }
      
  }
  class Child extends Parent{
      Child(int c){
          super(c);
          System.out.println(&quot;I AM IN Child&quot;);
          
      }
  }
  
  public class Super {
  
      public static void main(String[] args) {
          
          Parent one = new Parent();
          Child two = new Child(32);
          System.out.println(one.getA());
          
  
      }
  
  }
  </code></pre>
  <p>//Output</p>
  <p>I AM IN A AND THE VALUE OF a is : 32</p>
  <p>I AM IN B</p>
  <p>0</p>
  <p>I am not able to change the value of the variable a of the parent class using a constructor in the child class</p>