Question Locked

Counting character in java

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How to count word and count the maximum usable words or character

2 replies

by larryd4

length() method returns the number of characters in a string which is always one more that the last indice value?

public class TestLenght()
public static void main(String[] args){
String str = "inanutshell";
System.out.println("str.length() -> " + str.length() );
}
}
Output:
str.length()

Which results in the response "11"

This discussion is closed to new replies.