beyondgrader.com Logo
DemoBrowseAboutTeamLogin

Recursive Factorial

Geoffrey Challen // 2020.11.0

Create a public class Factorial that provides a single static method factorial. factorial accepts a single long and returns its factorial as a long. You can reject negative arguments and ones greater than 20 by throwing an IllegalArgumentException.

You should submit a recursive solution. The factorial of 0 is 1, and this represents the base case. The factorial of n is n * the factorial of n - 1, and this represents the recursive step.