+ 1

How to print values of two variables say x and y; *with space* and in the *same line *?

System.out_________________ ; // also mention the 2 variables in print statement.

11th Nov 2017, 7:44 PM
Amartya D
Amartya D - avatar
1 ответ
+ 4
int x = 42, y = 100; System.out.println("x is: " + x + " y is: " + y); // outputs - "x is: 42 y is: 100" // or System.out.println(x + " " + y); // outputs - "42 100" // or System.out.print(x); System.out.print(" "); System.out.println(y); // outputs - "42 100"
11th Nov 2017, 8:18 PM
ChaoticDawg
ChaoticDawg - avatar