Bookmark Topic Watch Topic
  • New Topic

garbage collection  RSS feed

 
shashank dwivedi
Ranch Hand
Posts: 67
AngularJS Java MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 66
Java Linux VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 541
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator


Locking.

shashank dwivedi, please UseOneThreadPerQuestion.(⇐click)
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!