1 Answer

answered by

As per the Oracle Java Specification in Chapter 12. Execution, it is mentioned that the method main must be declared public, static, and void. It must specify a formal parameter whose declared type is an array of String. Therefore, either of the following declarations is acceptable:

public static void main(String[] args)
public static void main(String... args)

Hence, as per the language specification, it is clear that the main method in Java cannot have any return type other than void.
The public static void main ( string[] args) is a signature by which JVM gets to know where to start execution of codes.

0 votes