1、replace中文意思为“取代,代替”

2、replace(A,B)
就是使用“B”替换“A”
1、输出结果:
HelloWorld

2、String dome = "H e ll o W o r l d";
System.out.println(dome.replace(" ",""));
使用空的字符串,替换了空格的字符串(所有的空字符串)

时间:2026-02-14 15:20:45
1、replace中文意思为“取代,代替”

2、replace(A,B)
就是使用“B”替换“A”
1、输出结果:
HelloWorld

2、String dome = "H e ll o W o r l d";
使用空的字符串,替换了空格的字符串(所有的空字符串)
