+ 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.
1 Resposta
+ 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"