Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
    Bookmark Topic Watch Topic
  • New Topic

garbage collection  RSS feed

 
Ranch Hand
Posts: 68
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?
 
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.
 
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?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Report post to moderator

Saurabh Pillai wrote:Double post. http://www.coderanch.com/t/573723/java-programmer-SCJP/certification/garbage-collection-eligibility



Locking.

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