public class Recurse1 { public static int factorial( int n ) { int sol1, mySol; if ( n == 0 /* the base cases */ ) { return 1; // The readily available solution for the base case } else { // factorial(n) is solved using solutions of // the smaller problem factorial(n-1)... sol1 = factorial ( n-1 ); // Solve a smaller problem mySol = n * sol1; // Use the solution of the smaller problem // to solve the original problem return mySol; } } public static void main(String[] args) { int r; r = factorial(3); System.out.println( factorial(3) ); } }