Java Question - Why is this an illegal start of an expression?

Zane

New member
It's fairly simple, it's about using recursion for fibonacci or something like that. I'm still struggling in my Java class so I'm not too sure what I'm doing wrong.

public int fib ( int intFib )
{
if ( intFib == 0 ) || ( intFib == 1 )
{
return intFib;
}
else
{
fib(intFib - 1 ) + fib(intFib - 2);
}
} //

Could someone explain what I'm doing wrong? You don't have to solve the whole thing for me (unless you want to, then you're extremely awesome), just explain what I have to do to fix it. If you notice anything else wrong with it, please tell.
 
Back
Top