Recursion is often associated with a method. A recursive method calls itself from within its own body. A recursive operation achieves exactly what an operation with iterations achieves. In principle, any problem that can be solved recursively can also be solved iteratively. With iteration, a set of instructions is executed repeatedly until some terminating condition has been satisfied. Similarly with recursion, a set of instructions, most likely a part of a method, is invoked repeatedly unless some terminating condition has been satisfied.
A recursive definition of a function consists of two parts:
One or more base cases define the terminating conditions. In this part, the value returned by the function is specified by one or more values of the arguments.
One or more recursive cases. In this part, the value returned by the function depends on the value of the arguments and the previous value returned by the function.