Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGrigorij Schleifer
10,365 PointsSystem.exit() question
Hey folks,
I dont understand the topic about the System.exit(0) method ....
Why do we have to input zero as an argument into exit() method to stop our prototype if age of the user is under 13 ....
Craig says that:
The exit method takes an argument for the status code which is, zero means that the system exited intentionally, like we had control of it. Any other non-zero value represents a status code that is used to state that it exited abnormally.
Thx
Grigorij
2 Answers
Christopher Augg
21,223 PointsGrigorij,
The System.exit() method's "argument serves as a status code; by convention, a nonzero status code indicates abnormal termination."
Regards,
Chris
Grigorij Schleifer
10,365 PointsHi Christopher,
I found a good explanation at StackOverflow :)
A X
12,842 PointsA X
12,842 PointsVery cookie cutter answer... :(