News
Recursion is (in many, but not all) languages slightly slower, and it does have some dangers (smashing the stack), but used properly it's a completely legitimate, valuable tool for production code.
Note that there are situations other than unbounded recursion in which a stack overflow might occur, but this blog posting is limited to StackOverflowError caused by unbounded recursion.
When the recursive Java factorial program runs, it creates a stack of method calls that look like this: factorialFunction(5) factorialFunction(4) factorialFunction(3) factorialFunction(2) ...
Results that may be inaccessible to you are currently showing.
Hide inaccessible results