Your infinite recursion continues because the classes instantiate each other within themselves, so ReverseGPA creates an instance of GPpredictor that creates a ReverseGPA that creates a GPpredictor that creates a ReverseGPA that creates a GPpredictor that creates a ReverseGPA that creates a GPpredictor ....
So, in a specific form, you have:
public class A { B b = new B(); }
and
public class B { A a = new A(); }
Stop Madness - Pass an instance to at least one of these classes using the constructor parameter or the setter method. I'm not sure what your classes do, so I can't say what (or if both of them) should do this.
Again, in a concrete way, at least one
public class A { B b; public void setB(B b) { this.b = b; } }
and
public class B { A a; public B(A a) { this.a = a; } }
And in the main method
public static void main(String[] args) { A a = new A(); B b = new B(a);
Hovercraft full of eels
source share