Q. Which of the following methods is used to replace all occurrences of a specified character in a string in Java?

  • (A) replace()
  • (B) replaceAll()
  • (C) replaceChar()
  • (D) replaceAllOccurrences()
πŸ’¬ Discuss
βœ… 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.
Explanation by: Gopal Sharma
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.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
209
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Gopal Sharma
Publisher
πŸ“ˆ
95%
Success Rate