if i write quit the program exits in java code example Example: how to exit a java program System.exit(0);