wood burning stoves*
The moose likes I/O and Streams and the fly likes Difference between  printWriter.println( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Difference between  printWriter.println("Sample");   and  printWriter.write("Sample");   in Servlets" Watch "Difference between  printWriter.println("Sample");   and  printWriter.write("Sample");   in Servlets" New topic
Author

Difference between printWriter.println("Sample"); and printWriter.write("Sample"); in Servlets

Bhaskar boddupalli
Greenhorn

Joined: Sep 07, 2012
Posts: 13
Hi,

Can some body please explain the difference between these two in Servlets.


and


Thanks.
Roger Sterling
Ranch Hand

Joined: Apr 06, 2012
Posts: 426

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 string.'


http://docs.oracle.com/javase/7/docs/api/java/io/PrintWriter.html
 
 
subject: Difference between printWriter.println("Sample"); and printWriter.write("Sample"); in Servlets