Home Discussion Discuss: String lastIndexOf(String str)

  • I don't understand the exampleSiva Praveen May 14, 2012 at 7:30 PM

    In the example you have shown lastIndexOf('the') in the output message. But in the actual method you have taken the substring as 'nest'. In the Output the index is shown as 2. Can you please explain how did u get the output and also for which sub string is that output meant to be.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java Tips and Examples

String lastIndexOf(String str)
String lastIndexOf(String str)     ... the lastIndexOf(String str) method of String class. We are going to use lastIndexOf(String str) method of String class in Java. The description of the code 

General

String lastIndexOf(String str, int fromIndex)
String lastIndexOf(String str, int fromIndex)  ... the detailed explanation about the lastindexOf(String str, int fromIndex) method of String class. We are going to use lastindexOf(String str, int fromIndex) method 

Java Tips and Examples

String lastIndexOf(int ch)
String lastIndexOf(int ch)     ... the lastIndexOf(int ch) method of String class. We are going to use lastIndexOf(int... of any character in a string we have applied lastIndexOf(int ch); method and then we 

General

String lastIndexOf(int ch)
 

Java servlets Tutorial

String lastIndexOf(int ch, int fromIndex)
String lastIndexOf(int ch, int fromIndex)   ... explanation about the lastindexOf(int ch, int fromIndex) method of String class. We are going to use lastindexOf(int ch, int fromIndex) method of String class in Java 

JavaScript Tutorial

JavaScript lastIndexOf method
illustrates the use of lastIndexOf() method. Here we have taken a string "Welcome... JavaScript lastIndexOf method       JavaScript method lastIndexOf() is very much similar 

Java Tips and Examples

String indexOf(String str)
String indexOf(String str)     ... the indexOf(String str) method of String class. We are going to use indexOf(String str... about the indexOf(String str) method through the following java program 

General

String equalsIgnoreCase(String Str)
String equalsIgnoreCase(String Str)   ... explanation about the equalsIgnoreCase(String Str) method of String class. We are going to use equalsIgnoreCase(String Str) method of String 

General

String indexOf(String str)
 

Java Tips and Examples

String indexOf(String str, int fromIndex)
String indexOf(String str, int fromIndex)   ... explanation about the indexOf(String str, int fromIndex) method of String class. We are going to use indexOf(String str, int fromIndex) method of String class in Java 

General

String indexOf(String str, int fromIndex)
 

General

String indexOf(String str, int fromIndex)
 

Programming Tutorials

JDOM CDATA Example, Use of append(String str) method of CDATA class.
JDOM CDATA Example, Use of append(String str) method of CDATA class.... The CDATA class is availablein org.jdom package. The append( java.lang.String string...(java.lang.String string) constructor of CDATA class crates a CDATA new node 

Java Technology Tutorials

java.lang.String.endsWith(String str)
endsWith() method is a string class method in Java. This is a simple endswith() java example, that check if the assigned string ends with the given string or not. If the given string does not ends with the given specific string(suffix 

General

Java String Examples
in Java. String lastIndexOf(String str)  In this section, you will get the detailed explanation about the lastIndexOf(String str) method of String class. We are going to use lastIndexOf(String str) method 

Java-Tutorials

String Functions In Java
, int fromIndex)   int lastIndexOf(String str) : This method.... Syntax : public int lastIndexOf(String str)   int lastIndexOf(String... is started from the given index. Syntax : public int lastIndexOf(String str 

Java Beginners

string
: "); String st=input.nextLine(); String str[]=st.split...string  a java program using string function to input any string... ArrangeStringAlphabetically { public static void main(String[] args 

Java Beginners

string
ExtractWords { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.print("Enter String: "); String st=input.nextLine(); String str[]=st.split(" "); for(int i=0 

Java Beginners

String
main(String[] args) { String str="Hello World"; String... characters in string?   import java.util.*; class RemoveDuplicateCharatcersFromString { public static String removeDuplicates(String

Java Beginners

string
*; import java.io.*; public class FirstLetter{ public static String capitalizeFirstLetter( String str ) { final StringTokenizer st = new StringTokenizer( str...string  a java program to input a string and display the string 

Java Tips and Examples

String Expressions
String Expressions Name ______________________ Assume the following: String a = "abc"; String h = "Hello"; String name = "Michael Maus"; Show what...( "Tomorrow".lastIndexOf('o') ); __________ System.out.println( name.substring 

Java Interview Questions

String question
{ public static void main(String[] args){ String[] str = new String[] { "Where...].equals(str[i -1])) continue; str[k++] = str[i]; } String[] st = new String[k... RemoveDuplicates{ public static void main(String[] args){ String[] str = new String 

Java Interview Questions

String Ques
String Ques  what is difference between String str="abc"; and String str=new String("abc");   Hello Friend, Differences: 1)String str...)String str = abc is a String literal where as String str = new String("abc 

Programming Tutorials

Java: String Exercise 1c
Java: String Exercise 1c Name ______________________ Assume the following: String a = "Adios"; String h = "Hasta luego"; Give the values...____________"I've been seen".lastIndexOf("e") 8____________"Length=" + a.length() 9 

Programming Tutorials

Java: String Exercise 1a
Java: String Exercise 1a Name ______________________ Assume the following: String h, a; h = "Hello"; a = "abc"; Give the values of the following...__________"Tomorrow".lastIndexOf("o") 10__________"Ans: " + 1 + 2 11 

General

Java: String Exercise 2
Java: String Exercise 2 Name ______________________ Assume the following: String s, t, h, a; String n, e; int i; h = "Hello"; s = " How are you...".indexOf("o", 3) 9__________"Tomorrow".lastIndexOf('o') 10__________"Tomorrow 

Java Interview Questions

reverse string
(System.in); System.out.println("Enter string: "); String str=input.nextLine(); String reverse = new StringBuffer(str).reverse().toString...reverse string  how to reverse a string without changing its place 

Java Beginners

string program
); System.out.print("Enter sentence: "); String st=input.nextLine(); String str...string program  reads sentence and find the average length of word... AverageLengthOfWords { public static void main(String[] args 

Java Interview Questions

reversing a string
reversing a string  how to reverse a string without using string function   class ReverseString { public static void main(String[] args) { String str="Hello World"; String st[]=str.split 

Java Tips and Examples

String Exercise 2 - Answers
Java: String Exercise 2 - Answers Name ______________________ Assume the following:> String s, t, h, a; String n, e; int i; h = "Hello"; s = " How..."Tomorrow".indexOf("o") 83"Tomorrow".indexOf("o", 3) 96"Tomorrow".lastIndexOf('o 

DMCA.com