I'm C programmer. I'd like the function main return a value but apparently main is alway void. Is it true in Java?
Main always returns void in Java. If you want your program to return an error value use System.exit()
Yes, in Java main is always public static void main(String[] args). Why would you want it to return a value anyways? It would just be returning to the enclosing java.exe process and not to the OS, which isn't very useful.
To exit and return a code to the OS, use System.exit(int code).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With