Write a Java program to print fibonacci series using recursion

Below program illustrates how to print fibonacci series using recursion in Java:

public class FibonacciUsingRecursion {
	public static void main(String[] args) {
		int prev = 0;
		int next = 1;
		fibonacci(100, prev, next);
	private static void fibonacci(int n, int prev, int next) {
		if(next <= n) {
			int x = prev + next;
			prev = next;
			next = x;
			fibonacci(n, prev, next);

Author: Mahesh

Technical Lead with 10 plus years of experience in developing web applications using Java/J2EE and web technologies. Strong in design and integration problem solving skills. Ability to learn, unlearn and relearn with strong written and verbal communications.