Programming Language String in Java Question #2224
Single Choice Not Set

Q
String str1 = "Kolkata".replace('k', 'a');
In the above statement, the effect on string Kolkata is

ID: #2224 String in Java 2,995 views
Question Info
#2224Q ID
Not SetDifficulty
String in JavaTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A The first occurrence of k is replaced by a.
  • B All characters k are replaced by a.
  • C All characters a are replaced by k.
  • D Displays error message
Correct Answer

Explanation

All characters k are replaced by a.

Share This Question

Challenge a friend or share with your study group.