day01 day learning

Here Insert Picture Description
Effect of the PrintWriter () is to define the location of the output stream, and this stream may be a normal memory Chinese, reducing output distortion. Example:
the PrintWriter the PrintWriter new new OUT = (the OutputStreamWriter new new (new new a FileOutputStream ( "D: /text.txt"), "UTF-. 8")); // define the location of the output stream, and the file must exist
out.println ( "Chinese Test "); // write to
out.close (); // close the stream
Note: The file stream must be promptly used up by close method to close, otherwise it will stay open until the program is stopped, increase the burden on the system

new StringWriter()

StringWriter sw = new StringWriter();
Here Insert Picture Description

Published 33 original articles · won praise 0 · Views 839

Guess you like

Origin blog.csdn.net/ninth_spring/article/details/105148849