3:53 pm - Sunday March 25, 8801

String Example Program for indexOf(int ch)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
@author: candidjava
@description: indexOf(int ch) is used to Returns the index within this string of the first occurrence of the specified character.
*/
public class DeeIndexOf
{
public static void main(String[] args)
{
String str="candid java";//get the strings
int i=str.indexOf('j');//this method is used to ?j? char index position in given string
System.out.println("the index is:  "+i);//print the index value
}
}

output:
the index is: 7

BACK

Filed in: Z-A All Java Codes

Comments are closed.