What will be the output of the following code?(2) string s="malayalam" System.out.println(s.indexOf('a')); System.out.println(s.lastIndexOf('a'));
Answers
Answered by
8
Answer:
1
7
Explanation:
index number starts from 0 and a is on 1th position
last index will show last occurrence of the alphabet so 7th is its last occurrence.
Similar questions