title: Inheritance concept: error:non-static variable this cannot be referenced from a static context
body: <p>The code below gives a compile time error:<code>non-static variable this cannot be referenced from a static context.</code>
  Could someone tell me where I've made a mistake? I'm new to programming so it would be great if you explain it step by step.</p>
  <pre><code>import java.util.*;
  public class Dog{
  int age;
  String name;
  public void BowBow(){
      System.out.println(&quot;Bow Bow I'm Dog1&quot;);
  }
  public  class Dog1 extends Dog{
      int age1;
      String name1;
      public void owow(){
          System.out.println(&quot;oow oow I'm Dog2&quot;);
      }
  }
  public class Dog2 extends Dog1{
      int age2;
      String name2;
      public void uhh(){
          System.out.println(&quot;uhh uhh I'm Dog3&quot;);
      }
  }
  public static void main(String [] args){
          Dog1 obj1 = new Dog1();
          Dog2 obj2 = new Dog2();
          Dog2 obj3 = new Dog2();
          obj1.age = 18;
          obj1.name = &quot;Hugo&quot;;
          System.out.println(&quot;age:&quot;+obj1.age);
          System.out.println(&quot;Name:&quot;+obj1.name);
          obj2.age1 = 19;
          obj2.name1 = &quot;Huxley&quot;;
          System.out.println(&quot;Age:&quot;+obj2.age1);
          System.out.println(&quot;Name:&quot;+obj2.name1);
          obj3.BowBow();
          obj3.owow();
          obj3.uhh();
  
    }
  }   
  </code></pre>