Question

Locked

Counting character in java

By saran.pearls ·
How to count word and count the maximum usable words or character

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

Are you referring to length()?

by LarryD4 In reply to Counting character in jav ...

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"

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums