Q. Which of the following methods is used to replace all occurrences of a specified character in a string in Java?
β
Correct Answer: (A)
replace()
Explanation: replace() is a method in Java used to replace all occurrences of a specified character or substring in a string with another character or substring.