0

string

why in print we have to add "+" when we have to print two names together like println("the name is:"+x"+""+y+");

6th May 2020, 7:03 AM
Ashish Kumar
Ashish Kumar - avatar
2 odpowiedzi
0
You don't have to do it if you dont want to. It is called string concatenation. It is there in the course to show how two strings can be added together.
6th May 2020, 7:08 AM
Avinesh
Avinesh - avatar
0
You can also use String.format for better readability. e.g. String.format("The name is: %s %s, name1, name2); Name1, Name2 - both are strings.
6th May 2020, 8:22 PM
Michal
Michal - avatar