public class Fibonacci
extends java.lang.Object
| Constructor and Description |
|---|
Fibonacci() |
| Modifier and Type | Method and Description |
|---|---|
static int |
fibonacci(int n)
A recursive method which calculates and returns a value in the Fibonacci series for
a positive integer or zero (0).
|
static void |
main(java.lang.String[] args)
Gets an integer from the console, passes it to method fibonacci() and
displays the resulting Fibonacci series value to the terminal window.
|
public static void main(java.lang.String[] args)
args - the String[] array command line parameterjava.util.InputMismatchException - if user enters non-integer inputjava.lang.Exception - if input integer is negative or greater than 40public static int fibonacci(int n)
throws java.lang.Exception
n - an integer whose Fibonacci Series value is to be calculatedjava.lang.Exception - thrown if the exponent parameter is a negative number