System. Exit (0) stops all contents in your entire virtual machine, while dispose () Only closes this window, but does not stop the entire application exit (). In any case, the memory is released! That is to say, even if the JVM is disabled, nothing else exists in the memory.
System. Exit (0) is normal exitProgramAnd system. Exit (1) or non-0 indicates that the program exits abnormally.
System. Exit (Status) will exit the program regardless of the value of status. Return is returned to the upper layer, while system. Exit (Status) is returned to the upper layer.
If this method is called immediately after an asynchronous request, it may cause the program to exit before the asynchronous request is complete. This will cause the asynchronous request to fail.
The best solution to this problem:
1) After an asynchronous request, a result is returned, and then exited Based on the returned result;
2) If no result is returned for an asynchronous request, it is best to add a function such as sleep to estimate the time required for the request. This can also be avoided, but it is not the best method.