Advertisements
Advertisements
प्रश्न
Given that:
String wt = "TELL ME WHEN WILL YOU COME?";
String wu = wt.replace('E', 'A');
How many replacements will take place?
पर्याय
4
3
2
1
MCQ
Advertisements
उत्तर
4
Explanation:
- The
replace('E', 'A')method scans the entire string from left to right and substitutes every single occurrence of the character 'E' with the character 'A'. - By looking at the string
"T**E**LL M**E** WH**E**N WILL YOU COM**E**?", we can see that the letter 'E' appears exactly four times, meaning four individual character replacements will take place.
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 10: String Handling - Exercises [पृष्ठ २४५]
