Sunday, January 4, 2015

Explain the reason behind ending a program with a System. exit (0)

Sometimes it is useful to terminate program immediately. This may lead to abnormal termination. The situation here is abnormal because the sequential execution of a program is forcefully terminated at run time, such that the next subsequent statements will be skipped off from execution.
In order to terminate the program forcefully we use System.exit(0) method.

The java.lang.System.exit() method terminates the currently running Java Virtual Machine.

0 comments:

Post a Comment