System.out is a PrintStream object. I read the documentation on PrintStream. What I don't get is why System.out.print causes the buffer to be flushed? Shouldn't that happen only for println?
Shouldn't that happen only for println?
No. Where did you get that idea? The Javadoc says
the output buffer will be flushed whenever a byte array is written, one of the println methods is invoked, or a newline character or byte ('\n') is written.
NB The Javadoc doesn't say when it won't be flushed. And it says it will be flushed on a println()
or a newline.