File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
I/O and Streams
Difference between printWriter.println("Sample"); and printWriter.write("Sample"); in Servlets
Joined: Sep 07, 2012
Apr 07, 2014 03:31:42
Can some body please explain the difference between these two in
PrintWriter printWriter = response.getWriter(); printWriter.println("Sample");
PrintWriter printWriter = response.getWriter(); printWriter.write("Sample");
Joined: Apr 06, 2012
Apr 07, 2014 04:55:45
One appends a CR-LF, and one does not.
But of course, you could have read this for yourself, if you looked at the documentation :
"Terminates the current line by writing the line separator
I agree. Here's the link:
subject: Difference between printWriter.println("Sample"); and printWriter.write("Sample"); in Servlets
Difference bet'n PrintWriter and FileWriter class.
Java Plugin Problem 1.3.1_02
difference between PrintWriter.println and PrintWriter.write
PrintWriter.write(int c) Question
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015