WEB DEVELOPER SITE
PHP7
 

Java String lastIndexOf() Method



Returns the index within this string of the last occurrence of the specified character.


Syntax

Here is the syntax of this method −

int lastIndexOf(int ch)

Parameters

Here is the detail of parameters −

  • ch − a character.

Return Value

  • This method returns the index.

Example


import java.io.*;
public class Test {

   public static void main(String args[]) {
      String Str = new String("Welcome to welookups.com");
      System.out.print("Found Last Index :" );
      System.out.println(Str.lastIndexOf( 'u' ));
   }
}

Run example »