String Handling – length()




                       int length();


length() method of String class is used to count the number of characters of invoking String object. It returns the length of string.

class Example1


public static void main (String arg[ ])


String s1 = “Code project”;

int l = s1.length();




     output :-  Length=12

3 thoughts on “String Handling – length()”

Leave a Reply

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