Thursday, 5 September 2013

PrintStream write() method in Java

PrintStream write() method in Java

Directly from this Java API:
write
public void write(int b)
Writes the specified byte to this stream. If the byte is a newline and
automatic flushing is enabled then the flush method will be invoked.
Note that the byte is written as given; to write a character that will be
translated according to the platform's default character encoding, use the
print(char) or println(char) methods.
I see it's specified the byte is written as given; However if I try to
write(65) I get the A I expected.
What should I write in write() in order to not match the same as it would
be with print()? Could you do any example?

No comments:

Post a Comment