I would like to know about the possible benefits of using or creating recursive functions in java applications.So, please enlighten me on where it is useful and we can get benefits of recursive calls.But I think, it takes more processing time than normal function.So, Why we use recursive calls in JAVA application?
Share
Sometimes recursion helps you to design simpler and more readable code. It is especially relevant for recursive data structures (like trees) or recursive algorithms.
The advantage is that you do not have to preserve state on each iteration. The JVM does it for you in form of call stack.
The disadvantage of recursive is that it requires more resources and its depth is limited by JVM.