String Handling – charAt()

 

syntax :-

char charAt ( int index);

 

charAt ( ) is standard inbuilt method of String class, it is used to find character at a given index number from the string of invoking object.

class Example1

{

public static void main (String arg[ ])

{

String s1 = “Code project”;

char   ch = s1.charAt (1);

System.out.println(ch);

System.out.println(s1.charAt(0));

}

}

output :-

O

C

 

 

Related Links

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *