The String length() method returns the number of characters in a specified string. The general form of this length() method is as follows:
For example, a String is given as follows:
Now to obtain the number of characters in str, use the length() method:
It will return 5, as this is the number of characters in str.
Click here to download scja test study guide and practice question. Download free practice test for CX310-019 SCJA exam.