溫馨提示×

java兩個字符串怎么拼接

小億
219
2024-05-09 12:26:49
欄目: 編程語言

在Java中可以使用加號操作符(+)來拼接兩個字符串。例如:

String str1 = "Hello";
String str2 = "World";
String result = str1 + " " + str2;
System.out.println(result); // Output: Hello World

另外,還可以使用concat()方法來拼接字符串。例如:

String str1 = "Hello";
String str2 = "World";
String result = str1.concat(" ").concat(str2);
System.out.println(result); // Output: Hello World

0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女