Skip to Content
The Java Workshop
book

The Java Workshop

by David Cuartielles, Pradeep Kumar Gupta, Scott Cosentino, Andreas Göransson, Eric Foster-Johnson, Avinash Kate
October 2019
Beginner
606 pages
10h 37m
English
Packt Publishing
Content preview from The Java Workshop

14. Recursion

Overview

In this chapter, we will see how using recursion can help you to write effective code. The chapter begins with an initial exercise illustrating one of the simplest mistakes you can make with recursion: forgetting to code a termination condition. The first step, then, is learning how to salvage your program when the Java stack has blown away. From there, you will learn to write recursive methods in order to handle mathematical formulas and other recurrent processing needs. Finally, with these techniques (and those further defined by this chapter), you will practice creating and processing XML files with the Document Object Model (DOM) API.

Introduction

Recursion is where a method calls itself, over and over again. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern Java Collections

Modern Java Collections

Simon Roberts
Java By Comparison

Java By Comparison

Simon Harrer, Linus Dietz, Jörg Lenhard

Publisher Resources

ISBN: 9781838986698Supplemental Content