Which method is used to get the length of a string in Java?

Explanation:
length() returns the string length.