How to exit a program in Java

In Java if we want to terminate the execution of the program then we make use of System.exit(n) method. Let us see important points : System.exit(n) method takes a non zero argument to indicate abnormal termination. System.exit(n) will exit the program irrespective of the operation being performed. If we call System.exit(n) within a try catch … Read more