So I am working on learning how to utilize recursion through Java. I have written a simple program that adds all the numbers between 1 and n and it looks to do it\'s job. Wh
I've drawn a sequence diagram, hope this can explain the recursion procedure.
There is a retrospective procedure for recursion, the next command will be pushed into the call stack before the recursion method is called.
So we can simply say System.out.println
will be pushed to call stack before recursiveCall
, then after the recursiveCall
returned the main process will continue with the top command on the stack, that is System.out.println
.