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 happens when a thread cannot acquire a lock on an object? : Java thread

545


What is function overriding and overloading in java?

587


What is reverse function?

578


What are the 4 types of characters?

547


I want to print “hello” even before main is executed. How will you acheive that?

664






What is the difference between hashmap and hashtable in java?

559


Why java is call by value?

552


What are the important features of Java 11 release?

584


What is the java reflection api? Why it’s so important to have?

565


What do you mean by inner class in java? Explain

592


What is dynamic array in java?

531


In how many ways we can do synchronization in java?

529


How can constructor chaining be done using this keyword?

591


What a static class can contains?

700


What does system out println () do?

564