Possible Duplicate:
Who calls the main function in java?
Consider this code:
class abc {
public static void main(String x[]) {
return;
}
}
Where does control go to when return is reached? When we execute this program, say via
$ java abc
the compiler searches for the main method and then proceeds further. In other cases, we call a function, and if we reach a return, control is returned to the last calling point.
The control is always returned to the call originator. In this case, the originator could be the operating environment, or another method that called main (remember, when it comes to being called, main is not special in any way; other methods can call it too).
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