You can provide an erroneous command to ProcessBuilder and then see the error get written to the error file and nothing in the output file. You could do this by changing the ProcessBuilder instance creation as follows:
ProcessBuilder pb = new ProcessBuilder("iostat", "-Z");
Compile and run by using the commands given earlier in the How to do it... section.
You will see that there is an error reported in the error file but nothing in the output file: