finished code example in section3, chapter10, StreamOutputFoFiles.java