I'm reviewing recursion these days and found out that a lot of Java recursive method samples are static. Can somebody explain why?
My guess is that they want to save memory, since logically a "parent" recursive method is staying dumb as long as its children recursive method is running and doesn't return anything yet.
Also please check if the following guess is right:
The static recursive method is running on the same thread while a non-static one may run on separate threads, is this correct or doesn't make any sense?
Because a recursive method/algorithm is generally controlled solely by its parameters and not by instance variables.
Any method that does not rely on instance variables can (and probably should) be made
static
.