0
System.out.println("my name is"+Firstname+" "+Secondname); Explain what is the need of " " in the middle?
string Firstname="David",secondname="mohan";
9 Answers
+ 6
Hello Shafiya,
if you did not insert the " ", your output would be:
my name is Davidmohan.
As you inserted the space, you will have:
my name is David mohan.
Actually you could have set your first string to "David ", so the output would already have the "space", or you could also set the second string to " mohan", which would give you the same result.
Hope it helped.
+ 1
the +" "+ is to insert a whitespace between first and last name. The blank space between the quotations is what you are inserting.
0
the " " is the statement you want to print as your out put. so when you run it, it should say:
my name is David mohan
0
It adds a space. The alternitive would be to write something like: string firstname = "David "
0
you need a " + " and do it so String Firstname ="David", secondname ="mohan"; thats Looks mich better i think
0
It's just SPACE character!
0
The " " in between actually creates a new string without creating a new variable, which helps to save memory. The + sign between the variable and the string actually serves the purpose of concatenating the tow strings
0
Thats because to show the JVM to print it there
"In between"
- 1
to give space