I was helping a friend to write some Java code, who doesn\'t know a lot about Java. So I wrote him some helper functions to easily get things done that are a little quirky i
If you want to try the output on JVM console, you'd better to get a Console instance with System.console(). And then get the PrintWriter with console.writer() method. After using the PrintWriter, you can close it. Based on the console description of JavaDoc,
Invoking
close()on the objects returned by thereader()and thewriter()will not close the underlying stream of those objects.
You can do this again and again. No need to worrying about reopen the stream.