JoonT
2
Q:

java best way to concatenate strings

public class Concat {
    String cat(String a, String b) {
        a += b;
        return a;
    }
}
2
// StringBuilder
String stringBuilderConcat = new StringBuilder()
    .append(greeting)
    .append(" ")
    .append(person)
    .append("! Welcome to the ")
    .append(location)
    .append("!")
    .build();
0

New to Communities?

Join the community