Yes Wilson you are correct. The lastIndexOf(int ch, int till) method of the String class probably functions in the following way. When you pass in the first agrument as an int that int is converted to a char. Then the second argument is the no. of characters you want from the String to be searched(simply a substring where the search would be done). Now that substring, is searched backwards or you can say the position of the last occurence of the first agrument(the char to be searched) is returned.
For example consider a String "1234567890654321"(name the above String str) now when I say str.lastIndexOf('6',3). The first agrument is '6' which means the char 6. Now a substring is created containing the first four(an agrument of 3 means 4 elements because the counting starts from 0) elements namely(1,2,3,4) and the char(6) is searched. Which ofcourse is not present. So the method returns -1. But if we use str.lastIndexOf('6',5) the substring that would be created would contain the elements(1,2,3,4,5,6) in which case the element is found. Now the location that is returned is the actual location of the character in the string, not in respect to any method parameter or so. In this case as 6 is in the fifth position so 5 is returned. In case there are two or more characters present in a string and the same char is used for the search then the last index of the char in the substring that is created would be returned. For example, "123123123" in this case if I search for 3 using "123123123".lastIndexOf('3',6) the new substring would be 1231231 and the position where last three occurs is 5 so the returned value is 5.
The substring creation mentioned in this post is just to explain how it works. I am not sure what approach
java uses, whatever the approach is the answer is the same. So no probs.
