if JVM spec mandates that main method should be public since "it can't
see main otherwise"
It can see but it doesn't see it as the entry point and that is why it gives NoSuchMethodError: main if you try to execute a class having no such method.
By classic design, the main entry point-
- Must be named main
- Must be public
- Must be static
- Must be void
- Must have one argument that is an array of string
Hence,
public static void main(String args[])
Being static, JVM can call it without creating any instance of class which contains the main method. Not sure if it is the main reason for main being static by design.
A class with default access like Hello in your example is only visible to other classes in the same package.