提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
Java String Concat
/**来自 n o w j a v a . c o m**/ public class Main { public static void main(String args[]){ String str1 = "Hello"; String str2 = " World"; //1. Using + operator String str3 = str1 + str2; System.out.println("String concat using + operator : " + str3); //2. Using String.concat() method String str4 = str1.concat(str2); System.out.println("String concat using String concat method : " + str4); //3. Using StringBuffer.append method String str5 = new StringBuffer().append(str1).append(str2).to