Here's a part of my code that is relevant to the problem solving
public long Recursiv(){
Fibonacci fibo = new Fibonacci(this.getNumar());
long fibnum;
if(this.getNumar() == 0) return 0;
if(this.getNumar() <= 2) return 1;
else
fibnum = (fibo.Recursiv()-1) + (fibo.Recursiv()-2);
return fibnum;
}
It is part of the Fibonacci class that I've created which has a constructor, a getter and setter methods.
My goal is to implement and print even fibonacci numbers in the console e.g. 2, 8, 34...etc.
In the main method, whenever I apply the method on the object I receive a java.lang.StackOverflowError message with the issue that the line which makes the assignment is the problem.
What should I do?
fibo.Recursiv()-1is doing?