package com.string.to;
public class ReplaceString {
public static void main(String args[]){
String s="i love you,you love me?";
System.out.println("替换前的字符串为: "+s);
String t=s.replace("love","notlove");
System.out.println("替换后的字符串为: "+t);
}
}
运行结果:
替换前的字符串为: i love you,you love me?
替换后的字符串为: i notlove you,you notlove me?