title: How is it possible to access the instance variable of aa abstract class to a class?
body: <p>How can I use this abstract class instance variable in my DemoAbs class?</p>
  
  <p>This is the D class:</p>
  
  <pre><code>abstract class D {
      int i=10;
      String str="java";
  
      D(){
          System.out.println("called abstract class constructor");
      }
  
      abstract void m1();
      void m2() {
          int i=20;
          System.out.println("called m2() in abstract class !");
      }
  }
  </code></pre>
  
  <p>This is the DemoAbs class:</p>
  
  <pre><code>public class DemoAbs extends D{
  
      // access instance variable here from abstract class
  
      DemoAbs() {
           System.out.println("called DemoAbs class constr");
  
      }
  
      @Override
      void m1() {
          System.out.println("inside m1() method");
      }
  
      public static void main(String[] args) {
          DemoAbs d=new DemoAbs();
          d.m1();
          d.m2();
      }
  }
  </code></pre>