1public static void main(String args[]){
2String s1="my name is khan my name is java";
3String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
4System.out.println(replaceString);
5}}
6
1String str = "..............................";
2
3 int index = 5;
4
5 char ch = '|';
6
7 StringBuilder string = new StringBuilder(str);
8 string.setCharAt(index, ch);
9
10 System.out.println(string);