package l515;
//例5.15
//字符串替换
public class NewStr { public static void main(String[] args) {
String str ="address"; //将字符串str中的字符"a"替换成"A"后返回新字符串newstr
String newstr =str.replace("a","A"); System.out.println(newstr);
} }
package l515;
//例5.15
//字符串替换
public class NewStr { public static void main(String[] args) {
String str ="address"; //将字符串str中的字符"a"替换成"A"后返回新字符串newstr
String newstr =str.replace("a","A"); System.out.println(newstr);
} }