This way returns the index of the preceding rate of the character in the value sequence depicted by this character that is less than or equivalent to fromIndex, or -1 if the value does not occur before that point.
Here is the syntax of this method:
int lastIndexOf(int ch)
Here is the detail of parameters −
Example
import java.io.*; public class Test { public static void main(String args[]) { String Str = new String("Welcome to Intellinuts.com"); System.out.print("Found Last Index :" ); System.out.println(Str.lastIndexOf( 'o' )); } }
This will produce the following result:
Found Last Index :27
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.