How to exit from a program in java?
3 answer(s)
Answer # 1 #
In Java, use System.exit(0); to terminate the program immediately. The argument 0 indicates normal termination.
Answer # 2 #
Alternatively, a program can exit naturally after completing the main method or return statements from methods.