Computer Science, asked by p10171471, 20 days ago

Differentiate between Replace and Replace All.​

Answers

Answered by kingslint
1

Answer:

The difference between replace() and replaceAll() method is that the replace() method replaces all the occurrences of old char with new char while replaceAll() method replaces all the occurrences of old string with the new string.

Explanation:

Answered by harshit1204
1

Answer:

String's replace() takes either two chars or two CharSequences as arguments and it will replace all occurrences of char or String but replaceAll() method takes regex String as argument and replaces each substring of that matches given regex with replacement string.

Similar questions