This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Bhaskar boddupalli
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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


and


Thanks.
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic