This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

garbage collection

shashank dwivedi
Ranch Hand

Joined: Mar 06, 2012
Posts: 55
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

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: 5874
    
    6

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
Double post. http://www.coderanch.com/t/573723/java-programmer-SCJP/certification/garbage-collection-eligibility
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 5874
    
    6



Locking.

shashank dwivedi, please UseOneThreadPerQuestion.(⇐click)
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: garbage collection
 
Similar Threads
What does this assignment mean?
one more question in GC
question about assertion
Garbage collection program really confusing me?
Garbage Collection query.