How to get terminating length in length of string in java?

39 views Asked by At

As the strings in C/C++ are terminated with the null character '\0', the strings in Java are terminated with length in length. How to get this length of string without using any in-built function in Java??

I tried to access it by using charAt() method but its giving out of bound exception. Also charAt() is an in-built method so I want to get it without using any in-built method.

1

There are 1 answers

0
Sanzhar Suleimenov On

I think that trying to find length of a string in Java without using .length() method is like avoiding Java at all. C++ and Java use different approacheds to handle strings.