Check out example codes for "java quit application". It will help you in understanding the concepts better.

Code Example 1

System.exit(n);

Code Example 2

System.exit(0);

Learn ReactJs, React Native from akashmittal.com