Program to find the length of any string using recursion in Java.
 In this program we have to find the length of any string, which contains N numbers of character.

For example, The String is "cprogrammingsimply". now we have to count the total number of character in this string.

ALGORITHM:-

Step 1: Create an String array
Step 2: Convert the String array in Character array (toCharArray())
Step 3: Now we will check the arrayname[i]th position is not '\n'
Step 4: Then increment the counter variable.
Step 5: else terminate the loop
Step 6: And print the counter values
Step 7: End

PROGRAM CODE:-

public class demo
{
    String s[]={"cprogrammingsimply"};
    Char c[]=s.toCharArray();
    int counter=0,i=0;
    void fun()
    {
         while(c[i]!='\n')
         {
             counter+=1;
             i++;
             fun();
         }
         System.out.println("the total number of character is: "+counter);
    }
    public static void main(String rags[])
    {
        demo d=new demo();
        d.fun(); 
    }
}
OUTPUT:-

the total number of character is: 19


Java program to calculate the length of string
How to find the length of string value using recursion
String length using recursion in java