title: What is the purpose of creating static object in Java?
body: <pre><code>class Demo {
     void show() {
        System.out.println("i am in show method of super class");
     }
  }
  class Flavor1Demo {
  
     //  An anonymous class with Demo as base class
     static Demo d = new Demo() {
         void show() {
             super.show();
             System.out.println("i am in Flavor1Demo class");
         }
     };
     public static void main(String[] args){
         d.show();
     }
  }
  </code></pre>
  
  <p>In the above code,  I do not understand the use of creating object d of Demo class with static keyword preceding it. If I eliminate the static keyword, it shows an error. Actually, I was going through anonymous inner class concept and got stuck here. Need help.... Can anyone please explain it?</p>