How to Terminate Running in Java


In this example, we will learn the method to terminate running in Java.

Source Code

package com.beginner.examples;

public class TerminateExample {

  public static void main(String[] args){
    System.out.println("exit");
    System.exit(0); // terminate running
  }
}

Output:

exit
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments