PrintWriter write() vs print() method in Java [duplicate]
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This question already has an answer here: What is the exact difference between out.write() and out.print() 9 answers What is the difference between write() and print() methods in PrintWriter class in Java? 回答1: print() formats the output, while write() just prints the characters it is given. print() handles many argument types, converting them into printable strings of characters with String.valueOf(), while write() just handles single characters, arrays of characters, and strings. To illustrate the difference, write(int) interprets the