0

Can I assign a different return type to main method?

8th Mar 2016, 11:59 PM
đŸ‡§đŸ‡· Caio Amaral
đŸ‡§đŸ‡· Caio Amaral - avatar
1 Answer
+ 4
No, main should return void. When main returns something, is often used by command interpreters and other external programs to determine whether the process completed successfully. To achieve the same effect in Java, you can use use the System.exit function. public static void main(String[] args) { //some code System.exit(88); //return a value }
18th May 2016, 9:22 AM
James Flanders