how to merge two strings in javva code example
Example 1: java concatenate strings
public class Concat {
String cat(String a, String b) {
a += b;
return a;
}
}
Example 2: java best way to concatenate strings
// StringBuilder
String stringBuilderConcat = new StringBuilder()
.append(greeting)
.append(" ")
.append(person)
.append("! Welcome to the ")
.append(location)
.append("!")
.build();