how to terminate a java program in the code code example Example: how to exit a java program System.exit(0);