0

How to have no line break with for/while loops in Java?

So if I do this code: int x = 0; for(x=0;x<5;x++){ System.out.println(x) } This outputs 1 2 3 4 But I want 1 2 3 4 in Java how to do it?

13th Oct 2018, 4:22 AM
Potato Hacker
Potato Hacker - avatar
1 Respuesta
+ 4
System.out.print(x + " ") ;
13th Oct 2018, 4:32 AM
Daniel (kabura)
Daniel (kabura) - avatar