Q. String str1 = "Kolkata".replace('k', 'a');
In the above statement, the effect on string Kolkata is
β
Correct Answer: (B)
All characters k are replaced by a.
Explanation: replace() method returns a new string resulting from replacing all occurrences of oldChar in this string with newChar.