What is the purpose of the String length() method?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the purpose of the String length() method?
Rating:
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.
Rating:
Was this information helpful?
Other articles
- What is the executeQuery() method?
- What is a thin client?
- What is composition?
- What is the purpose of the java.awt package?
- What is RMI?