New to JAVA need some help with println multiple variables, I want to add a space
(Answered) Hello My name is harry nash (lostbit)
I am new to JAVA. I want to know how to insert space between
the value of two variables in the println statement. The code below
outputs GoodbyeMood10 and I want GoodbyeMoon 10
String var1 = "GoodbyeMoon";
int var2 = 10;
System.out.println(var1 + var2);
The fix System.out.println(var1 + "s "+var2);
Re: New to JAVA need some help with println multiple variables, I want to add a spac
If you want to concatenate Strings use the + operator between the Strings.
For a single space, the String to use is two "s with a single space between them: " "