length()
Try it yourself →Returns the number of characters.
Syntax
text.length()
Description
Returns text length (method with parentheses — in arrays, length is a property without parentheses).
Example
public class Main {
public static void main(String[] args) {
System.out.println("hello".length());
}
}Expected output
7
When to use?
Length check.