Computer Science, asked by Omm579, 4 months ago

What is the significance of System.exit(0)?​

Answers

Answered by Feirxefett
9

Answer:

exit(0) : Generally used to indicate successful termination. exit(1) or exit(-1) or any other non-zero value – Generally indicates unsuccessful termination.

Answered by XxDABICAKExX
1

Answer:

The function 'System.exit(0)' is used when we want to terminate the execution of the program at any instance. As soon as this function is invoked, it terminates the execution, ignoring the rest of the statements of the program.

Explanation:

Sometimes, it may happen that the execution of the whole program is not over but your requirement is fulfilled. Under such situation, you would like to terminate the execution in the middle of the program. 'System.exit(0)' fiction will help you to carry out this task. During the course of running the program, as soon as this function is invoked, it will terminate the execution of the program. Thus, the execution of the remaining statements of the program will be than ignored.

Similar questions