Explain the reason behind ending a program with a system.exit(0)?



Explain the reason behind ending a program with a system.exit(0)?..

Answer / Ashish Mathur

System.exit(0) is used to terminate a Java program immediately and return 0 as the exit status to the operating system, indicating that the program has executed successfully. Other non-zero values can be passed to System.exit() to indicate different types of errors or failures.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?

2 Answers  


Can a class declared as private be accessed outside it’s package?

1 Answers  


diff. b/w JAVA and javascript...

3 Answers   NIIT,


Is alive method in java?

1 Answers  


What is the properties class?

1 Answers  


What are the 3 types of loops in java?

1 Answers  


explain about jre and jvm

2 Answers  


What are the different types of data structures in java?

1 Answers  


what is the Diff. between Access Specifiers and Access Modifiers?

39 Answers   BMC, Cyber Shot, Infosys, VTS, Wipro,


why we import both packages java.awt.*; and java.awt.event.*; as java.awt.*; can import all classes na. then what is the need of importing java.awt.event.*; ?

3 Answers  


What is java object name?

1 Answers  


Can a static class have a constructor?

1 Answers  


Categories