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

I got curious with System.exit(0) so I put (1) to see what happens but didn't see any difference between a 0 or 1.

I've gotten code right. But I was wondering what happens when adding a greater number then 0 no System.exit. The results was the same. Is the code too short to see a difference or is that how it is?

1 Answer

Exit terminates a process, in this case the java program you are running. 0 shows successful termination and any number other than 0 indicates faulty termination. You might not be able to see much but when you run a software and it throws an error code... ex. error 984, that often happens which the use of such exit function that returns a certain exit code which helps indicate a specific error and terminates the process. So basically the 0, 1 etc you placed in that exit method, is returned to the operating system to indicate if it was terminated successfully or not, that's why you don't see much of a difference.

Oh okay, thanks Gloria for clear that up for me.