lengthString
charAt→Returns the length of the string.
Syntax
str.length()Example
Enter values below to update the example in real time.
String→System→out→println→String s = "Hello, Java!";
System.out.println(s.length()); // 12