Tell me, please, but why is the output command after the loop used here? we have already indicated it in the cycle itself ...

for (int i = 0; i <= SIZE; i++) { System.out.print(i + " "); } System.out.println(); 

Closed due to the fact that the essence of the issue is incomprehensible to the participants of Suvitruf , entithat , insolor , 0xdb , MSDN.WhiteKnight 3 Sep '18 at 6:49 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    You have after the withdrawal of a newline in a loop. You next time just try to remove the code and see the difference. - Viktorov
  • The question "why the output command is used here" should be asked to the person who wrote this code. How do we know what was in his head? - Dmitriy

3 answers 3

System.out.println() - in this case, the line break, because after println operations will be performed on the next. line (similar to System.out.print("\n") ).

Pro console I / O: Metanit .

About the differences between print and println: JavaRush .

    The cycle uses the print () command, which writes the values ​​in one line, and after the cycle, the author transfers the cursor to a new line, using the println () command.

      A hike, this is so famously a line feed organized. Read about the differences between print and println