Java tutorial
public class Main { public static void main(String[] args) { String str = "java2s.com"; System.out.println("string = " + str); CharSequence s1 = "j"; CharSequence s2 = "b"; String replaceStr = str.replace(s1, s2); System.out.println("new string = " + replaceStr); } }