java.lang.String.length()


 

java.lang.String.length()

java.lang.String.length(): is the Java String class method that returns the actual length of the String.

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

Ads