public class FindAndReplaceAllOccurrencesOfASubstringInAString_Java {
public static void main(String[] args) {
String str = "c++ php go c python php phpphphp php rust";
String word = "php";
String replacewith = "JAVA";
str = str.replaceAll(word, replacewith);
System.out.println(str);
}
}
/*
run:
c++ JAVA go c python JAVA JAVAJAVAhp JAVA rust
*/