• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

Best way to terminate Java app?

I'm working on a task using Java.

It's a simple space-invaders-esque game, I'm trying to implement a Pause prompt which also allows the user to quit the game from the prompt.

However, what's the best way to do this? System.exit(0) is the obvious one i've seen. But this looks messy, it looks like it terminates the entire JVM. The other manner is to have all Swing windows closed, but this in itself looks too convoluted as well.

Is there a simple way to do this?
 
Top