How do you replace a string in java?



How do you replace a string in java?..

Answer / Abhinav Kashyap

You can replace a string in Java using the `replace()` method. For example, `str.replace("oldString", "newString")`. However, if you want to perform case-insensitive or regular expression replacement, consider using `replaceAll()`.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

how can i kill thread without stop() and destroy()

1 Answers  


How to make a non daemon thread as daemon?

1 Answers  


What are the differences between the constructors and methods?

1 Answers  


What is a marker interface?

2 Answers  


What is ctrl m character?

1 Answers  


Explain how hashmap works?

1 Answers  


What is array length?

1 Answers  


If circular link of two objects, then will it be garbage collected ?

3 Answers   TCS,


what are the jsp tags with example?

1 Answers   Photon,


What are the changes in java.io in java 8 ?

1 Answers  


What’s the difference between unit, integration and functional testing?

1 Answers  


What are the different access modifiers available in java?

1 Answers  


Categories