日期:2014-05-20  浏览次数:20793 次

一个lastIndexOf的用法题, 请高手解决
请问下题的结果是多少?
System.out.println( "this   is   a   Sample. ".lastIndexOf( "i "));
主要是想问一下,lastIndexOf()的用法。

------解决方案--------------------
结果是5
------解决方案--------------------
最后出现这个字符的位置,开始是0.
------解决方案--------------------
0t
1h
2i
3s
4
5i
------解决方案--------------------
从左到右,最后出现的i在is里。