Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (6.5k points)
How to implement an exit from the execution from a JAVA Program?

1 Answer

0 votes
by (11.3k points)
edited by

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. 

Related questions

0 votes
1 answer
0 votes
1 answer
asked Aug 24, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...