end java application code example Example 1: how to exit a java program System.exit(0); Example 2: java quit application System.exit(n);