此方法返回此对象表示的字符序列中该字符最后一次出现的索引,如果没找到,则返回-1。
int lastIndexOf - 语法
这是此方法的语法-
int lastIndexOf(int ch)
这是参数的详细信息-
ch - 一个字符。
int lastIndexOf - 返回值
- 此方法返回索引位置。
int lastIndexOf - 示例
import java.io.*; public class Test { public static void main(String args[]) { String Str=new String("Welcome to Learnfk.com"); System.out.print("Found Last Index :" ); System.out.println(Str.lastIndexOf( f )); } }
这将产生以下输出-
Found Last Index :16