Search code examples
javaexitexit-code

Make java exit out of current program


How do I make java quit the program when it is triggered? I have tried pretty much everything I can do, but I just can't make it quit.


Solution

  • You can use System.exit(0); where 0 is the exit code. This works on all platforms (including android).

    Here is a link to the official documentation if you require further reading: Oracle Documentation