We can concatenate two strings using concat()
, shown here:
String concat(String str)
concat()
performs the same function as +. For example,
String s1 = "one"; String s2 = s1.concat(" two");
puts the string "one two" into s2.
It generates the same result as the following sequence:
String s1 = "one"; String s2 = s1 + "two";