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 trial

Java Java Basics Perfecting the Prototype Reviewing Our Feedback

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

System.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
Christopher Augg
21,223 Points

Grigorij,

The System.exit() method's "argument serves as a status code; by convention, a nonzero status code indicates abnormal termination."

Regards,

Chris

Very cookie cutter answer... :(