The System class provides the exit method to stop the Java Virtual Machine (JVM). : System « Utility Classes « SCJP






public class MainClass{
    public static void main(String[] argv){
       System.exit(9);
    }
}
The exit method should not be called in a Java applet. 
It is the Web browser's responsibility to halt the JVM as needed.








8.29.System
8.29.1.The System and Runtime Classes
8.29.2.A Timing Utility
8.29.3.The System class provides the exit method to stop the Java Virtual Machine (JVM).