I have seen some people talking about it and my question is...

I have a program that opens a input and output stream,
when the program gets the message '#end' it should terminate the program.

Does it really matter if I close the in-and output streams and then close the program or if I just do a System.exit() ?
Everything will be closed and released anyway?

5 Years
Discussion Span
Last Post by JamesCherrill

If you do a System.exit your program will terminate immediately and any unflushed buffers will be discarded, and any system resources you are holding may not be released. You should use try/catch/finally to ensure files and closed and resources released, and ideally allow your program to terminate normally by finishing all your threads.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.