[Solved] Regarding doing research on a main method() [closed]


The main method must be declared public, static, and void; from JLS 12.1.4:

The method main must be declared public, static, and void. It must specify a formal parameter (§8.4.1) whose declared type is array of String. Therefore, either of the following declarations is acceptable:

  public static void main(String[] args)


  public static void main(String... args)

Some JVM implementations in the past have not required a publicly accessible main method. On occasion this has been used to add private testing methods into APIs.

While the method modifiers public and static can be in any order (JLS 8.4.3), they must all come before the return type (JLS 8.4), so any combination such as void static is illegal.

solved Regarding doing research on a main method() [closed]