Author
garbage collection
shashank dwivedi
Ranch Hand
Joined: Mar 06, 2012
Posts: 55
posted Apr 16, 2012 23:07:18
0
class A{
A()
{
System.out.print("Inside A");
}
}
class B extends A{
B()
{
System.out.print("Inside B");
}
}
class GcDemo
{
public static void main(String args[])
{
B b1=new B();
B b2=new B();
b1=b2;
}
}
how many objects are eligible for garbage collection and why?
Prabaharan Gopalan
Ranch Hand
Joined: Oct 16, 2009
Posts: 66
posted Apr 18, 2012 13:23:32
1
It would be better if you could tell us what you think the answer is and we can have a discussion around it if needed. Sure there are people here who can give the answer right away but it'd be nice to not have the feeling that we're just doing somebody's homework.
Googling doesn't make you a genius. But not Googling makes you dumber.
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5807
posted Apr 18, 2012 14:11:02
0
shashank dwivedi wrote:
how many objects are eligible for garbage collection and why?
Yes, tell us first what you think.
Also, eligible for GC at which exact point in the code ?
Saurabh Pillai
Ranch Hand
Joined: Sep 12, 2008
Posts: 449
posted Apr 18, 2012 14:19:15
0
Double post. http://www.coderanch.com/t/573723/java-programmer-SCJP/certification/garbage-collection-eligibility
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5807
posted Apr 18, 2012 14:22:02
0
Locking.
shashank dwivedi, please UseOneThreadPerQuestion .(⇐click)
subject: garbage collection