We use the statement, System.exit() to accomplish the termination of the execution of a JAVA program. Now, it can have a few parameters passed as the argument of the function:
exit(0) : Generally used to indicate successful termination.
exit(1) or exit(-1) or any other non-zero value – Generally indicates unsuccessful termination.
This statement helps in retaining and conserving resources being used by redundant instances of JAVA virtual machines.