Question: I'm working on the Java batch program that should exit with different codes based on various conditions. The program will be triggered and monitored by CA7 scheduler which will use exit code to trigger other jobs.

Apparently there are couple of ways to exit:

```
System.exit(int code) 

```

and 

```
Runtime.getRuntime().exit(int code)

```

Both of these methods will work, but which one is more appropreate to use?

Answer: 
There is no real difference, however it is just convention to use `System.exit();`

[Source](http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exit%28int%29)

> 
> The System.exit method is the conventional and convenient means of
>  invoking this method.
> 
> 
>
The call `System.exit(int status)` is effectively equivalent to the call: `Runtime.getRuntime().exit(int status)`

`System.exit(int status)`, terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code indicates abnormal termination.
**This method calls the exit method in class Runtime.**