title: Can we create an object outside of methods but inside the class? If yes then what's the purpose of creating an object outside the class?
body: <pre><code>public class C 
  {
      public void p() { System.out.println(" method p"); }
  
      public static void main(String[] args) {System.out.println(" main method");}
  
      C c1 = new C(); // Why java allows this? that is, creating object outside of 
                   //the methods but inside the class? 
                   //For what purpose does Java allowed this? when is this needed?
  
      c1.p(); //This generates error, Why is this not allowed?
  }
  </code></pre>