Fibonacci series using recursion in java
<p>I am trying to generate a <strong>Fibonacci series</strong> of first ten element using recursion. But the compiler give error. Please help me to find the exact solution.</p>

<p>// The program is given below:</p>

<pre><code>public class DemoJava {

    int a=0, b=1, c=0, count=10;

    public void fibonacciRecursion(count) {

        if(count&gt;0){

            c = a+b;
            a = b;
            b = c;
            System.out.println(c);
            fibonacciRecursion(count-1);

        }
    }

    public static void main(String args[]){

        System.out.println("This is a Demo Program.");
        System.out.println(a);
        System.out.println(b);

        DemoJava dj = new DemoJava();
        dj.fibonacciRecursion((count-2));
    }
}
</code></pre>

<p>// Error is given below:</p>

<pre><code>error: &lt;identifier&gt; expected
        public void fibonacciRecursion(count) {
                                            ^
1 error
</code></pre>