Java program to replace certain characters from string without using predefined methods. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java program to replace certain characters from string without using predefined methods.

How can we do this with the help of array?

10th Sep 2017, 6:13 AM
Jatin Agarwal
Jatin Agarwal - avatar
3 Answers
+ 8
It is possible, if you use a String array, loop through it, search for equality and replace those chars by assigning a new value to the element. But it is recommended to use equals method to check equality for good reasons, so this is not safe.
10th Sep 2017, 7:13 AM
Tashi N
Tashi N - avatar
+ 8
@Empty But who would do that? ;) https://code.sololearn.com/cUrUfZyc1TZt/?ref=app
10th Sep 2017, 7:23 AM
Tashi N
Tashi N - avatar
+ 1
@Empty, it is possible in Java.
11th Sep 2017, 12:28 PM
Jatin Agarwal
Jatin Agarwal - avatar