public class StringReplace { public static void main(String[] args) { String str = new String("Hello how are you, welcome to TutorialsPoint"); System.out.println("Contents of the String: "+str); str = str.replace("welcome to TutorialsPoint", "where do you live"); System.out.println("Contents of the String after replacement: "+str); } }