Exit basic functions

I am relatively new to Stackoverflow and Java, but I have little experience with C. I liked the very clean way to exit C programs after crashing with the "exit ()" function.

I found a similar System.exit () function in Java, which is different from the C function, and when should I use "System.exit ()" better than just "returning" to Java, for example, in the void main function?

+5
source share
3 answers

System.exit()will complete jvm initialization for this program, where it return;simply returns the control from the current method back to the caller


Also see

+5
source

System.exit() , . return main(), , . . ( ), . , . , , , - , , ( , 2).

+2

System.exit()It may be convenient when you are ready to shut down the program on the condition of the user (that is, a GUI application). returnused to return to the last point of program execution. These two operations are very different.

+1
source

All Articles