Please provide guidance in understanding recursion : <pre><code>public static int countX(String str) {
    if (str.length() == 0) {
        return 0;
    }
    if (str.charAt(0) == 'x') {
        return 1 + countX(str.substring(1));
    } else {
        return countX(str.substring(1));
    }
}
</code></pre>

<p>Given an input String of "xxx", the method above shall return 3. 
I understand the flow of the method, the line <em>"return 1 + countX(str.substring(1));"</em> adds one if an 'x' is found. What I don't understand is how does that return value carry over to the next iteration/recursion? I don't see the value of the increment stored anywhere.</p>
