Just as the title says im trying to get the sum of a string's characters values, but in a recursive way and without for loops
i tried to do this, but it says that a return type required?

private stringSum(String s, int i)
    {
        if (i==a.length)
            return 0;
        return ((int)s.charAt(i)+ stringSum (s, i+1);
    }

wow haha sorry guys nevermind this i just noticed that i forgot to add the type "int" hehe

Haha. Glad you got it solved so quickly!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.