System.out is a static PrintStream that writes to the console. We can redirect the output to a different PrintStream using the System.setOut() method which takes a PrintStream as a parameter. The RedirectSystemOut class shows how we can have calls to System.out.println() output to a file rather than to the console by passing System.setOut() a PrintStream based on a FileOutputStream.