[Solved] What output of the both program is different?


The first one won’t have any output since the stdout stream wasn’t flushed by a newline (or a manual call).

In Java, the method called is println, so it’s adding a newline at the end of the string, causing the stream to flush.

solved What output of the both program is different?