It replaces a character with another character or a substring with another substring at all its occurrences in the given string.
Syntax:
String <variable-name> = <string-variable>.replace(<character or substring to replace>, <new character or substring>);