Java String.lastIndexOf(int ch, int fromIndex)
Syntax
String.lastIndexOf(int ch, int fromIndex) has the following syntax.
public int lastIndexOf(int ch, int fromIndex)
Example
In the following code shows how to use String.lastIndexOf(int ch, int fromIndex) method.
public class Main {
public static void main(String args[]) {
String s = "this is a test from java2s.com.";
//from w ww . j a va 2 s.c om
System.out.println(s);
System.out.println("lastIndexOf(t, 60) = " + s.lastIndexOf('t', 60));
}
}
The code above generates the following result.