public class Recurse2 { public static int fibonacci( int n ) { int sol1, sol2, mySol; // Define variable... if ( n == 0 /* the first base case */ ) { return 1; // The readily available solution for this base case } else if ( n == 1 /* the second base case */ ) { return 1; // The readily available solution for this base case } else { sol1 = fibonacci ( n-1 ); // Hire "fibonacci" to solve first smaller problem sol2 = fibonacci ( n-2 ); // Hire "fibonacci" to solve second smaller problem mySol = sol1 + sol2; // Use the solutions of the smaller problems // to solve my own problem return mySol; } } public static void main(String[] args) { int r; r = fibonacci(5); System.out.println( r ); } }