I am in a little bit confusion with system.exit. I founded some things about from this link.
but I have some doubts in my mind. If I use system exit, what will happened to the created objects,variable and ect. Are everything get destroyed once I called system.exit? If "Yes" then why we force to the garbage collection before system.exit() ? If "No" how long the created objects are stored in the JVM (memory)? If run the program again after exit from system, what will happened to the previous objects if they not destroyed once I called System.exit();?
Thanks.
I think in this case it is useful to think of the JVM as a program running on a computer. System.exit() terminates that program. Nothing within the program is kept by the computer's OS or the JVM runtime, though the program, of course, may write things to long-term storage. But variables, created objs, and etc. are all gone, and cannot be restored.