Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

How do I end a program if I have multiple methods?

–1 vote
asked Aug 2, 2020 by Logan Wright (150 points)
If I wanted to make a system that took an answer, and based on that answer either continued the program or ended it, how would I do that?  More generally, how would I end a program at a certain point?

1 Answer

+1 vote
answered Aug 5, 2020 by Peter Minarik (89,040 points)



where errorCode indicates the return code of the program. Usually it's 0 for normal termination.

See the documentation: https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#exit(int)

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.