Static View of Recursion

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

A base case of a recursive definition is a case that has an immediate solution.

factorial( 0 ) = 1 <-- base case
factorial( N ) = N * factorial( N-1 )

Static View of Recursion

In the "static view" of recursion, you translate a math-like definition into the Java method definition. You don't think much about what happens when the method runs. Here is the math-like definition of recursion:

factorial( 0 ) = 1
factorial( N ) = N * factorial( N-1 )

And here is part of its translation into a Java method:

int factorial( int N )
{
  if (  )
  
    return 1;
    
  else
  
    return  *  ;
}

Practice thinking statically. Translate the math-like definition into the Java code.

QUESTION 3:

Fill in the blanks.