This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printwriter vs System.out.println()
 
Similar Threads
unbale to view xml file in browser
printwriter vs system.out.println
file io
Enter in text file
PrintWriter out.println() or System.out.println() - which gives better perfromance ?