Methods of the Class String
In this lesson, we will look at the behavior of strings by examining some of the methods in the class String.
We'll cover the following
All strings are objects belonging to the class String
. As such, every string has certain behaviors that are defined by the methods in the class String
.
The method length
The method length
provides the number of characters that are in a string, including any spaces. For example, the statements in the following program display 21
:
Get hands-on with 1400+ tech skills courses.