About 101,000 results
Open links in new tab
  1. Terminating a Java Program - Stack Overflow

    Mar 17, 2014 · I found out ways to terminate (shut-down or stop) my Java programs. I found two solutions for it. using return; When I want to quit or terminate my program execution , I add …

  2. How to quit a java app from within the program - Stack Overflow

    Jan 15, 2014 · You can use System.exit() for this purpose. According to oracle's Java 8 documentation: public static void exit(int status) Terminates the currently running Java Virtual …

  3. How to break out or exit a method in Java? - Stack Overflow

    Jun 3, 2016 · Pls note: We may use break statements which are used to break/exit only from a loop, and not the entire program. To exit from program: System.exit() Method: System.exit has …

  4. java - Best way to exit a program when I want an exception to be …

    May 30, 2011 · If you really do wish to terminate the program immediately, rather than letting upper levels of the program decide what to do (maybe the core of your program will be …

  5. How do I use System.exit () in Java - Stack Overflow

    Dec 17, 2024 · The java.lang.System.exit() method terminates the currently running Java Virtual Machine. The argument serves as a status code; by convention, a nonzero status code …

  6. How to close a Java Swing application from the code

    Oct 1, 2013 · Using EXIT_ON_CLOSE will forcibly terminate the application. If you need to take action before the program exits (such as saving working data), then you have to tap into the …

  7. How to add option to exit from switch case in Java

    Aug 29, 2015 · System.exit(int status); Usually, status >= 0 indicates that the program terminated correctly and status < 0 indicates an abnormal termination. I think you should use: …

  8. Terminate a console application in Java - Stack Overflow

    Aug 24, 2012 · Well, yes, but you shouldn't really be using it in either case (to exit an application); it terminates the entire VM, per the documentation. – Clockwork-Muse Commented Aug 24, …

  9. Is there a way to end the program if statement is false?

    Feb 22, 2014 · A Java program must never be stoped with System.exit. It is akin to pulling the plug on your computer just to close Chrome. An application is closed when all the (non …

  10. java - How to close a GUI when I push a JButton? - Stack Overflow

    Dec 26, 2011 · By using System.exit(0); you would close the entire process. Is that what you wanted or did you intend to close only the GUI window and allow the process to continue …