title: why main method can't be of default scope?
body: <p>If we declare the class with default scope(non-public) and  public main method it executes successfully. Here class scope is mote stricter than main method scope.</p>
  <p>But if we declare main method as default, then JVM will throw error. Why?</p>
  <pre><code>class DefaultTest {
      public static void main(String[] args) {
          System.out.println(&quot;output.........&quot;);
      }
  }
  </code></pre>
  <p>Runs successfully but</p>
  <pre><code>class DefaultTest {
      static void main(String[] args) {
          System.out.println(&quot;output.........&quot;);
      }
  }
  </code></pre>
  <p>this won't.</p>
  <p><strong>I mean if the class itself is not public JVM can still access main method that means there is no need of main to be public. But if we don't declare it as public, it will throw an error.</strong></p>