+
操作符String str1 = "Hello, ";
String str2 = "World!";
String result = str1 + str2;
StringBuilder
类StringBuilder builder = new StringBuilder();
builder.append("Hello, ");
builder.append("World!");
String result = builder.toString();
StringBuffer
类StringBuffer buffer = new StringBuffer();
buffer.append("Hello, ");
buffer.append("World!");
String result = buffer.toString();
String.concat
方法String str1 = "Hello, ";
String result = str1.concat("World!");
String.format
方法String result = String.format("%s%s", "Hello, ", "World!");