Summary

Section 15.1 Introduction

  • A recursive method calls itself directly or indirectly through another method.

  • When a recursive method is called to solve a problem, the method actually is capable of solving only the simplest case(s), or base case(s). If it is called with a base case, the method returns a result.

Section 15.2 Recursion Concepts

  • If a recursive method is called with a more complex problem than a base case, it typically divides the problem into two conceptual pieces—a piece that the method knows how to do and a piece that the method does not know how to do.

  • To make recursion feasible, the piece that the method does not know how to do must resemble the original problem, but be a slightly simpler or smaller version of it. Because ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.