1

There are two classes:

public class B {
    A obj = new A();
}

and

public class A {
    B obj = new B();
}

As we can see that class A has reference to class B and vice versa. So both classes need each other for successful compilation.

This seems to be a deadlock scenario, but eclipse is able to compile this. How does this work?

Michael
  • 3,093
  • 7
  • 39
  • 83
codingenious
  • 8,385
  • 12
  • 60
  • 90

0 Answers0