How can I change this code so that the command prompt closes when it finishes executing?-Collection of common programming errors
Store the Runtime object in a variable to use it, and then call it’s exit() method when you’re done.
exit(int status):
Terminates the currently running Java virtual machine by initiating its shutdown sequence.
Without storing in a variable:
Runtime.getRuntime().exit(0);