Length of string without using java built in function

Tutorials Shared by the Internet Community

Advertisements


Synopsis

The length of the string is easy to define for example But what happens if we dont want to use the java built in method

Statistics

  • Total Hits - 13475

  • Total Votes - 134 votes

  • Vote Up - 58 votes

  • Vote Down - 76 votes

  • Domain - javahungry.blogspot.com

  • Category - JAVA/Core JAVA

  • Submitted By - Java Hungry

  • Submitted on - 2013-11-22 12:44:14

Description

The length of the string is easy to define , it is the number of characters in the string including white spaces .
Java make the things easy as it provides the built in length method for the String class (java.lang.String) which is a final class .
for example :
String demo = " This is java built in method example "
int length= demo.length();

But what happens , if we don't want to use the java built in method to calculate the length of the string .
Then there is also a way to calculate the length of the string ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements