+ 2
In string concatenation what is the use of ""between two variables?
When I wrote "My name is "+firstname+lastname It printed the same text as "My name is"+firstname+""+lastname would give. So what is the use of ""between firstname and lastname?
6 Respostas
+ 21
String firstname="Gaurav",lastname="Agrawal";
String str="my name is " + name +" "+ lastname;
//might is was " " , not ""
//" " is used to provide some space between firstname & lastname
//if we have not used " " , then str will be "GauravAgrawal"
//when we use " " , then str will be "Gaurav Agrawal"
//hope it helps ☺
+ 16
yeah @LunarCoffee 😃
+ 10
No difference as it's indicating an empty string was used. Otherwise it's most likely a space like this " " to separate words in between. 😉
+ 1
@Gaurav you're platinum now! :D
+ 1
Thanks Gaurav
0
thank you so much