They don't. If a program asks for input to close then the programmer has added to code to accomplish that. When your main method exits the program will close.