Why doesn't the class containing main have to be public?
<p>I declared the following class</p>

<pre><code>class A { //not public
  public static void main(String args[]) {
     System.out.println("done");
 }
</code></pre>

<p>When I compile and run it, it runs fine and prints the output "done". Same behavior even when I declare it as being in a "package a;"</p>

<p>However, if JVM spec mandates that main method should be public since "it can't see main otherwise", shouldn't it apply to the class as well? 
If the JVM "can't see" A.main() when it is not declared public, how is it able to see the class A itself.</p>

<p>Is there any explanation for this other than "because the specification says so"?</p>
