Share via


Runtime.Exit(Int32) Method

Definition

Terminates the currently running Java virtual machine by initiating its shutdown sequence.

[Android.Runtime.Register("exit", "(I)V", "GetExit_IHandler")]
public virtual void Exit (int status);
[<Android.Runtime.Register("exit", "(I)V", "GetExit_IHandler")>]
abstract member Exit : int -> unit
override this.Exit : int -> unit

Parameters

status
Int32

Termination status. By convention, a nonzero status code indicates abnormal termination.

Attributes

Remarks

Terminates the currently running Java virtual machine by initiating its shutdown sequence. This method never returns normally. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.

All registered #addShutdownHook shutdown hooks, if any, are started in some unspecified order and allowed to run concurrently until they finish. Once this is done the virtual machine #halt halts.

If this method is invoked after all shutdown hooks have already been run and the status is nonzero then this method halts the virtual machine with the given status code. Otherwise, this method blocks indefinitely.

The System#exit(int) System.exit method is the conventional and convenient means of invoking this method.

Java documentation for java.lang.Runtime.exit(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to