Advertisements
Advertisements
Question
System.out.println("Computer Science"
lastlndexOf('E')):
The output of the statement given above will be:
Options
8
7
−1
15
MCQ
Advertisements
Solution
−1
Explanation:
The lastlndexOf() function finds the index of the last occurrence of the argument in the string. If 'E' is not found in "Computer Science", the function returns −1. So the output is −1.
shaalaa.com
Is there an error in this question or solution?
2021-2022 (March) Official Board Paper
