Saturday, January 8, 2011

Q. What is the difference between a Buffered Writer and a Print Writer?


Ans. These classes were implemented for different aims. For example, Print Writer is just a convenient class to write some text information. It is convenient because it has methods to write strings, any primitives (double, float, ...) and so on, you should not convert primitive to string, some useful methods have been already implemented. 

Buffered Writer was implemented not for user convenience but for performance. The main aim of this class is to buffering characters that means if you call write(char[]) method it will flush characters to underlying outputstream only when some threshold will be reached.

No comments:

Post a Comment