Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Coding and a cup of Java

An introduction course to programming

Ending a program.

  • 2013-06-27 01:04:35
    Is there any way in the code to end the actual program like terminate it.
  • 2013-06-27 05:41:35
    System.exit(int status) can be used to exit a program:

    http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#exit%28int%29
  • 2013-06-27 14:55:15
    Alright thanks man!
  • 2013-07-03 15:45:50
    Also, the return statement stops the method currently running. This means that if you are in the (void) main method, you'll terminate the program.
    In methods, the return; statement is somewhat of a break for methods, which can be very useful at times (mostly for efficiency).
  • 2013-11-05 11:12:36
    This helped me a lot thank you jpf.
  • Log in or sign up to reply to this thread