21.5. Raw Type and Backward Compatibility

 
[Page 635]

Chapter 19. Recursion

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To know what a recursive method is and the benefits of using recursive methods ( §19.1).

  • To determine the base cases in a recursive method ( § §19.2 “19.5).

  • To understand how recursive method calls are handled in a call stack ( § §19.2 “19.3).

  • To solve problems using recursion ( § §19.2 “19.7).

  • To use an overloaded helper method to derive a recursive method ( §19.5).

  • To solve the Towers of Hanoi problem using recursion ( §19.6).

  • To draw fractals using recursion ( §19.7).

  • To understand the relationship and difference between recursion and iteration ( §19.8).


[Page 636]

19.1. Introduction

A recursive method is a method that invokes itself directly or indirectly. Recursion is a useful programming technique. In some cases, using recursion enables you to develop a natural, straightforward, simple solution to a problem that would otherwise be difficult to solve. This chapter introduces the concepts and techniques of recursive programming and uses examples demonstrating how to "think recursively."

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net