Q. Which method of the String class would you use to get the number of characters in a string?
Solution:
The length() method returns the number of characters in the string. size() is used for collections like ArrayList, and length is a property for arrays.
Get Question Bank
Strengthen Your Practice with our comprehensive question bank.