Recursion is when a function calls itself. In this video, learn how to recurse in Java and some possible applications of doing so.
- [Instructor] The next advanced concept, … we're going to look at is called recursion. … Now, this is a concept that you've probably heard before … but maybe you've never seen it in action. … Recursion is simply when a function calls itself. … And while doing this can very easily … lead to an infinite loop, if we're not careful. … It can also be used to solve certain problems … that aren't easy to solve using functional programming. … So, let's take a look at … a very simple example using recursion. … What we're going to do, is create a function … that behaves like a for loop, … without actually using a for loop. … So, before we get started, … one kind of goofy thing about recursion in Java … is that we can't really do it … by defining functions with lambda syntax. … Well, it is possible, but in my opinion, … it's a little clumsy. … So for now, we'll just use a regular static method … for this example. … So what we're going to do … is we're going to call this function countdown. … So we'll say, …
Skill Level Advanced
Java Design Patterns: Structuralwith Bethan Palmer1h 38m Intermediate
1. Introduction to Functional Programming
2. First-Class Functions
3. Working with Streams in Java
4. Advanced Concepts
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.