Question: Java PrintStream significance and where to use this?
I found many programmers using PrintStream in their codes. I looked for this,but failed to get the clear idea of its significance,Why to use it?
"Unlike other output streams, a PrintStream never throws an IOException and the data is flushed to a file automatically i.e. the flush method is automatically invoked after a byte array is written."
So what's the benefit if flush is automatically invoked?
private PrintStream x = null;
Now what could be the possible reasons if someone declares x like this?
PrintWriter class prints the characters rather than the bytes whereas, PrintStream class prints the characters into bytes. Characters are converted into byte using default character encoding.
For reading more in detail you may go through the following link, may this will be helpful for you.