The parameter of exit should qualify if the execution of the program went good or bad. It’s a sort of heredity from older programming languages where it’s useful to know if something went wrong and what went wrong.
Exit code is
0
when execution went fine;1
,-1
,whatever != 0
when some error occurred, you can use different values for different kind of errors.
If I’m correct exit codes used to be just positive numbers (I mean in UNIX) and according to range:
1-127
are user defined codes (so generated by callingexit(n)
)128-255
are codes generated by termination due to different unix signals like SIGSEGV or SIGTERM
But I don’t think you should care while coding on Java, it’s just a bit of information. It’s useful if you plan to make your programs interact with standard tools.
Related Posts:
- Exception in thread “main” java.util.NoSuchElementException
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- What’s the simplest way to print a Java array?
- javax vs java package
- What is a stack trace, and how can I use it to debug my application errors?
- How to fix “A JNI error has occurred, please check your installation.”
- Java Runtime Environment not found error when I open an application
- “PKIX path building failed” and “unable to find valid certification path to requested target”
- What exactly does a jar file contain?
- What is the best way to implement constants in Java?
- What is the reason behind “non-static method cannot be referenced from a static context”?
- What does ” || ” mean in Java? [duplicate]
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- “int cannot be dereferenced” in Java
- What is a Key-Value Pair?
- Java optional parameters
- Understanding Spring @Autowired usage
- What is a serialVersionUID and why should I use it?
- SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”
- The difference between += and =+
- exception in initializer error in java when using Netbeans
- typeof in Java 8
- Switch on Enum in Java
- error upon assigning Layout: BoxLayout can’t be shared
- Why do this() and super() have to be the first statement in a constructor?
- Else without if
- Keytool is not recognized as an internal or external command
- Cannot find “Package Explorer” view in Eclipse
- Error: Could not find or load main class in intelliJ IDE
- Java Hashmap: How to get key from value?
- Understanding the difference between null and ‘\u000’ in Java
- What does .class mean in Java?
- What is the best math library to use with java?
- What is the difference between a null array and an empty array?
- Why is there no String.Empty in Java?
- How to initialize List
object in Java? - PrintWriter append method not appending
- Using ADB to capture the screen
- What is the difference between response.sendRedirect() and request.getRequestDispatcher().forward(request,response)
- Recursion vs. Iteration (Fibonacci sequence)
- What is difference between Errors and Exceptions?
- What is the difference between Integer and int in Java?
- Static Error: This class does not have a static void main method accepting String[]
- “uses unchecked or unsafe operations”
- possible lossy conversion from long to int?
- Convert String to int array in java
- eclipse won’t start – no java virtual machine was found
- What causes “‘void’ type not allowed here” error
- Variable might not have been initialized error
- Java substring: ‘string index out of range’
- throw checked Exceptions from mocks with Mockito
- How to sort an array of objects in Java?
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- keytool error Keystore was tampered with, or password was incorrect
- How to override toString() properly in Java?
- Returning null in a method whose signature says return int?
- Hibernate Error: a different object with the same identifier value was already associated with the session
- How to solve the “failed to lazily initialize a collection of role” Hibernate exception
- Initializing multiple variables to the same value in Java
- Java: Unresolved compilation problem
- FXML Load exception
- NullPointerExcetion Native Method Accessor… Hashing Words Issue
- How to convert currentTimeMillis to a date in Java?
- How to clear console in Java – Eclipse
- Java TreeMap Comparator
- What is the use of System.in.read()?
- Invalid escape sequence (valid ones are \b \t \n \f \r \” \’ \\ )
- JDK was not found on the computer for NetBeans 6.5
- In Java, how to assign the variable number=Integer.parseInt(args[0]) a value if no argument is passed?
- Get keys from HashMap in Java
- Determine if a String is an Integer in Java [duplicate]
- How do I run Java .class files?
- Fill an array with random numbers [duplicate]
- Connection Java – MySQL : Public Key Retrieval is not allowed
- Whitespace Matching Regex – Java
- Size has private access in ArrayList
- Iterator for a linkedlist
- Hide Utility Class Constructor : Utility classes should not have a public or default constructor
- Android – Start service on boot
- JsonMappingException: No suitable constructor found for type [simple type, class ]: can not instantiate from JSON object
- Sending POST data in Android
- When is “java.io.IOException:Connection reset by peer” thrown?
- Java ArrayList of Doubles
- what is update-alternatives command in linux and what is the use of it?
- java: use StringBuilder to insert at the beginning
- Error: ‘)’ expected compiler error
- How does addNotify() and requestFocus() work in Java with JPanel?
- DTO and DAO concepts and MVC
- How to extract .war files in java? ZIP vs JAR
- What is the difference between run-time error and compiler error?
- What is the difference between ArrayList.clear() and ArrayList.removeAll()?
- Test if element is present using Selenium WebDriver?
- Increase heap size in Java
- android.content.res.Resources$NotFoundException: String resource ID #0x0
- what does x– or x++ do here?
- How to print a table of information in Java
- set background color: Android
- Class Declarations for temperature program in Java
- Spring Boot – Cannot determine embedded database driver class for database type NONE
- Convert double to float in Java