How to get length of string in Java?

What is the method of String for getting the length?

How to get length of string in Java?

Tell me code fast.

Thanks

View Answers

September 12, 2014 at 5:51 AM

Hi,

You may use the following code:

String str= "Good Tutorials";
int length = str.length();

You have to use the str.length() to get the length of a String object.

Thanks









Related Tutorials/Questions & Answers:
Advertisements