wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Printwriter vs System.out.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 » Beginning Java
Bookmark "Printwriter vs System.out.println()" Watch "Printwriter vs System.out.println()" New topic
Author

Printwriter vs System.out.println()

Muhammad usman shad
Ranch Hand

Joined: Jan 06, 2010
Posts: 30
why we dont use Printwriter class for output in java instead of system.out.println???
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

JavaDocs wrote:
All characters printed by a PrintStream are converted into bytes using the platform's default character encoding. The PrintWriter class should be used in situations that require writing characters rather than bytes.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
John de Michele
Rancher

Joined: Mar 09, 2009
Posts: 600
Muhammad:

It is also because the PrintWriter class didn't come until JDK 1.1, while the System and PrintStream classes have been in the API since 1.0. Since the in/out/err objects are publicly exposed, they couldn't be changed without breaking backwards compatibility.

John.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Thats more correct answer, John.
 
 
subject: Printwriter vs System.out.println()