+ 6
how does cursor move to another line after printing 2????
public class Program { public static void main(String[] args) { int[ ] primes = {2, 3, 5, 7}; for (int t: primes) { System.out.println(t); } } } output is: 2 3 5 7
2 ответов
+ 7
Because you have used System.out.println(t). This statement moves cursor to new line after printing the line
You can use System.out.print(t) if you want all numbers in one line
+ 3
U are using the println word which prints a line and then moves to another line.
If you want to print it in one line then use the word print instead of println