Java - Strings Class-String lastIndexOf(String str) Method - Java


This method accepts a String as an argument, if the string argument occurs one or more times as a substring within this object, then it returns the index of the first character of the last such substring is returned. If it does not occur as a substring, -1 is returned.


Here is the syntax of this method −


Here is the detail of parameters −

  • str − a string.

Return Value

This method returns the index.


This will produce the following result −


All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Java Topics