What is the replace() method?
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 replace() method?
Rating:
The replace() method is a method of the String class. This method takes two character arguments. It creates a new string after replacing all the occurrences of a particular character in the string with another character. The string that invokes this method remains unchanged. The general form of the method is given below:
For example,
"Hallo".replace('a','e'); //when executed it returns "Hello"
Rating:
Was this information helpful?
Other articles
- What are the metacharacters used with the regular expression?
- What is NumberFormatException?
- Things to practice for Sun test CX310-055.
- What is Generics?
- What is a JAR file?