学习记录29

使用 concat() 方法
public class StringConcatenationWithConcat {
public static void main(String[] args) {
String str1 = "Hello";
String str2 = " World";
// 使用 concat() 方法拼接字符串并覆盖 str1
str1 = str1.concat(str2);
System.out.println("拼接并覆盖后的字符串: " + str1);
}
}

posted @ 2025-02-20 20:02  吉尼泰梅  阅读(9)  评论(0)    收藏  举报