A

Admin • 832.27K Points
Coach

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()
  • Correct Answer - Option(A)
  • Views: 32
  • Filed under category Java
  • Hashtags:

Explanation by: Admin

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.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.