logo

String LastIndexOf(int Ch, Int FromIndex)


Show

Description

This way returns the index of the preceding rate of the character in the value sequence depicted by this character that is less than or equivalent to fromIndex, or -1 if the value does not occur before that point.

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 Intellinuts.com");
      System.out.print("Found Last Index :" );
      System.out.println(Str.lastIndexOf( 'o' ));
   }
}

This will produce the following result:

Output

Found Last Index :27

Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.