Question was asked to find the length of a String in Java without using any inbuilt functions like length(), toCharArray()? My approach was to somehow convert it into charArray so that we can itterate and find the length.
I searched but in most of the places charAt() is used which is again a inbuilt function.
I checked how java does it. String class have a count variable which stores length of the string. But it is private and final. So we cant access it outside String class. For storing string, String class uses a character array, which is also private and final. So we cant use this array also to find the length.
So need to know how can we find it? or Is it possible also to find the length without using any inbuilt functions?