Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection

 
Nikitha Reddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,
I have one doubt.Please clarify my doubt.

class A
{
public static void main(String arg[])
{
B b=new B();
b=null;--> how to restore this object?Is there any method to restore this object?
}
}
class B
{
int i;
B()
{
i=10;
}
}
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to restore this object?Is there any method to restore this object?


Do you mean to reassign it to the original object ? The answer is no, unless you have another reference that points to that object.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic