What is the use of the replace() method of the String class?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the use of the replace() method of the String class?
Rating:
The replace() method of the String class replaces a given character in a given string with a new character. The general syntax for this method is as follows:
For example, Sting s="Hello";
Now the following syntax will replace all the l's in this string with m's:
Rating:
Was this information helpful?
Other articles
- What tasks CANNOT be performed by an applet?
- What is final?
- What are instance variables?
- What are local variables?
- What is the while loop?