Advertisements
Advertisements
Question
Given that:
String kr = "Albert Einstein";
int pr = kr.indexOf('e');
What will be the value of pr?
Options
4
3
12
13
MCQ
Advertisements
Solution
3
Explanation:
- The string is Albert Einstein.
indexOf('e')returns the index of the first lowercase 'e'.- The first lowercase 'e' is in Albert at index 3 (counting starts from 0).
shaalaa.com
Is there an error in this question or solution?
Chapter 10: String Handling - Exercises [Page 245]
