O'Reilly logo

Groovy Programming by John Savage, Kenneth Barclay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX G MORE ON METHODS

A method that can make a call on itself is known as a recursive method. When the method makes a direct call on itself from within its own method body, we refer to this as direct recursion. When one method calls another that, in turn, calls the first again, we refer to this as indirect recursion. Recursion is an extremely powerful approach for expressing many elegant programming solutions.

In this appendix, we demonstrate recursive methods as well as other aspects of methods such as statically typed parameters and return values.

G.1 RECURSIVE METHODS

A method may invoke any other method. Programmers exploit this facility to build programs hierarchically, in which one method invokes submethods to perform subsidiary ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required