Java – PrintWriter write() vs print() method in Java

filejava

What is the difference between write() and print() methods in PrintWriter class in Java?

Best Solution

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 argument as a single character to be printed, while print(int) converts the integer into a character string. write(49) prints a "1", while print(49) prints "49".

source: http://www.coderanch.com/t/398792/java/java/write-print