The Java length() method

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr

This is one of the articles from our Java Tutorial for Beginners.


The Java String length() Method

The length() method is used to find a String's length (the number of characters in a String).

 

The signature of the Java String length() method is below:

Example:

If you run this code on your computer, you will see the following in the console:

13

Commentary:

This line of code allows to display the length in characters of the sentence "I adore Java." We did this with the help of the length() method. If you count all the letters and spaces and the period in the sentence "I adore Java.", you will get the number 13.

As you see, everything is very simple.


You can find more articles in our Java Tutorial for Beginners. 

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr

Facebooktwittergoogle_plustumblrFacebooktwittergoogle_plustumblr
Самоучители--узнать детальнее--