Redirect standard output

If you want to change the location to where the standard output messages go there’s a method in the System class called setOut() which takes a PrintStream instance as argument.
In this code example we show how to redirect all standard output messages to a file by creating a FileOutputStream instance and pass it to the PrintStream instance that is sent to the setOut method, like so:

Search for more Java info on this site here:
Custom Search

Any thoughts or questions?