You can never create an instance of any class that does this
class B {
B b = new B();
}
because it will give a StackOverflowError. Every instance of B contains another instance of B which contains another instance of B which contains... and it goes on until the stack runs out of room.
This, on the other hand, works fine:
class B {
B b;
}
The variable "b" can refer to another instance of B, but creating an instance of B doesn't automatically create another instance of B, which is what leads to the error.
I can't give a more specific description of how to "fix" the problem, because your program isn't a real program, after all -- we'd have to know what you were trying to accomplish.