Results 1 to 3 of 3

Thread: system.exit(..)

  1. #1
    Join Date
    Jun 2008
    Location
    Mumbai
    Posts
    2
    Rep Power
    0

    Default system.exit(..)

    Plz tell me what is the difference between exit(0),exit(1),exit(2)?

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    the integer values are just a flag... (depends on you)...

    In convention, 0 means the java simple/complex application exits without any again any suspicious/malicious process being done before the java application exits...

    a positive value will be thrown after terminating the process when an exception occured before the termination of that process....

    an example is like:
    trying to access dead Component's instance after calling dispose method, after calling garbage collector and System.runFinalization() and before invoking System.exit(int flag)..

    Usually, for me, negative values are being treated as flag for an experiment......

    eg. having some experiments on an "under testing" application where the program's behavior should be traced when it terminates, what location of the code it terminates exactly, and for prediction/debugging purposes....

    PS. you've posted this thread in an inappropriate forum section...
    Last edited by sukatoa; 06-09-2008 at 04:11 PM.
    freedom exists in the world of ideas

  3. #3
    ferranb is offline Member
    Join Date
    Jun 2008
    Posts
    22
    Rep Power
    0

    Default

    Each process runing on a system if its terminates nicely it returns a value to the parent process.

    By convention the 0 means normal termination, any other value depends on the developer mind.

    To terminate a java proces, you have the exit() function the argument is the return value of the proces.

    Ferran

Similar Threads

  1. Could not find the main class, program will exit.
    By aryubi in forum New To Java
    Replies: 39
    Last Post: 02-19-2010, 10:02 AM
  2. JVM terminated Exit code=1
    By oregon in forum Eclipse
    Replies: 3
    Last Post: 09-29-2008, 09:49 PM
  3. help with System.exit (1) function call
    By katie in forum Advanced Java
    Replies: 2
    Last Post: 08-06-2007, 08:03 PM
  4. How to exit the program..
    By coco in forum New To Java
    Replies: 1
    Last Post: 08-01-2007, 05:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •