If circular link of two objects, then will it be garbage
collected ?

Answer Posted / rt

Yes it will be garbage collected.

e.g.

public void testMethod(){
A a= new A();
B b = new B();

a= b;
b= a;

}
After above method get executed Object a & b will be garbage
collected.

Is This Answer Correct ?    3 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the base class for error and exception?

643


What is passing by reference in java?

629


What is a boolean structure?

655


What is the difference between serial and throughput garbage collector?

667


What is api in java?

631






Explain the reason behind ending a program with a system.exit(0)?

683


What is the use of string and stringbuffer?

662


Can we serialize static variables in java?

747


Why isn’t there operator overloading?

691


What is data object example?

617


How do you define a variable?

620


How does callback work in java?

685


How is hashcode calculated in java?

588


What is a constructor, constructor overloading in java?

627


Can we convert integer to string in java?

710