-
What is the output of this program?
public class Result
{
public static void main(String args[])
{ String str = "Interview Mania";
int K = str.indexOf('v');
int L = str.lastIndexOf('i');
System.out.print(K + " " + L);
}
}
-
- 13 5
- 3 5
- 5 13
- 5 3
- None of these
Correct Option: C
indexOf() method returns the index of first occurrence of the character where as lastIndexOf() returns the index of last occurrence of the character.