在java中替换字符串中的单词

在java中替换字符串中的单词,java,Java,如何将值“the”改为“this string”中的“That”这是一本真实的故事书。这本书背后的故事是关于一位英雄她的妻子和他们的孩子“你本可以更深入地了解string类,这是一个可用的方法 String sentence = "There is the book of Real Story. The Story behind the book is about a hero her wife and Their children"; sentence.replace("the","that"

如何将值“the”改为“this string”中的“That”这是一本真实的故事书。这本书背后的故事是关于一位英雄她的妻子和他们的孩子“

你本可以更深入地了解string类,这是一个可用的方法

String sentence = "There is the book of Real Story. The Story behind the book is about a hero her wife and Their children";
sentence.replace("the","that");