0
what return when main method becomes static void
what become void
2 Réponses
+ 1
main method doesn't return any value, because its return type is void.
if the main method is not void the program do not start
0
If the return type of a method is 'void' then - answering to "what (to) return" - you return nothing, as said above by Simone. If you want to exit in the middle of the method, because job is done, then use 'return' without any further arguments:
void someMethod() {
//do something
if (/*job is done*/) {
return;
}
//do stuff
}