Home Tutorial Java StringExamples java.lang.String.length()

 
 

Share on Google+Share on Google+
java.lang.String.length()
Posted on: March 27, 2005 at 12:00 AM
Advertisement
java.lang.String.length(): is the Java String class method that returns the actual length of the String.

java.lang.String.length()

length() is the Java String class method that returns the actual length of the String. The length() method will always returns integer value for any given String for example...

String str = "mylength";
//length() method
int length = str.length();
System.out.println("String Length is : " + length);

the output is:

String Length is : 8

Java length method is specified in CharSequence interface and it always return the length of the characters represented by this object.

Example Codes

length() Method In Java

String Array In Java

Advertisement

Related Tags for java.lang.String.length():


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 27, 2005

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com