Advertisements
Advertisements
प्रश्न
Given that:
String ab = "Aaron Bernstein";
String db = ab.substring(ab.lastIndexOf('e');
What will be the length of db?
पर्याय
8
3
2
0
MCQ
Advertisements
उत्तर
3
Explanation:
The
lastIndexOf('e') method finds the last occurrence of the letter 'e' in "Aaron Bernstein", which is at index position 12. The substring(12) method then extracts everything from that index to the end of the string, resulting in the word "ein", which contains exactly three characters.shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 10: String Handling - Exercises [पृष्ठ २४६]
