+2 votes
in JAVA by
Can we have any other return type than void for main method in Java?

1 Answer

0 votes
by

No, Java class main method can have only void return type for the program to get successfully executed.

Nonetheless , if you absolutely must return a value to at the completion of main method , you can use System.exit(int status)

Related questions

0 votes
asked May 18, 2020 in JAVA by AdilsonLima
+3 votes
asked May 31, 2020 in JAVA by SakshiSharma
...