Comment on Tutorial - indexOf( ) and lastIndexOf( ) in Java By Hong



Comment Added by : Kyle

Comment Added at : 2012-03-22 09:17:04

Comment on Tutorial : indexOf( ) and lastIndexOf( ) in Java By Hong
ASNWERING: what's the purpose of indexOf('t',10) ?

The purpose is to look for the index of the character 't' STARTING at index 10;

For instance:
String str = "hello world";
//Let's say you wanted to find the index of the second 'o'.
//You say:
System.out.println(str.indexOf('o',5));
//This searches the string for 'o' starting immediately after
// first 'o'. (Remember, Strings are simply arrays, and their
// indexes start out at 0.


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. it's really amazing & very easy to understand
View Tutorial          By: Vaibhav Bhalerao at 2010-08-17 10:54:52

2. Your solution is really helped me. Thanks for your
View Tutorial          By: Rajakumar at 2010-05-31 06:05:53

3. it's very good example to understands overloading
View Tutorial          By: Rakesh Sharma at 2011-11-18 06:37:49

4. not bad
View Tutorial          By: JUST_PREET at 2013-03-06 11:37:15

5. know someone how to compare various objects?

View Tutorial          By: Peter at 2009-10-07 07:32:31

6. hai.....people ..............


View Tutorial          By: spartan at 2009-08-08 08:42:35

7. it is a good example thanks
View Tutorial          By: tadeleh at 2012-11-13 12:46:08

8. please try to elaborate the explanation with examp
View Tutorial          By: bhavitha at 2014-02-21 06:09:12

9. it was very helpful to fix one obscure bug
View Tutorial          By: ander13 at 2009-06-30 04:51:47

10. Nice article. Really helpful in understanding the
View Tutorial          By: Sundar at 2011-12-18 11:15:07