• Post Reply Bookmark Topic Watch Topic
  • New Topic

Scope and for loop  RSS feed

 
Ijaz Ul-Haque
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.

I have the follwoing code:

 
Tapas Chand
Ranch Hand
Posts: 614
9
BSD Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think?
What should be the answer and why?
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If variables loose the references of the object then garbage collector will collect the object and destroy it.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tushar Goel wrote:If variables loose the references of the object then garbage collector will collect the object and destroy it.


BUT - when that happens is up to the garbage collector so you can't say for sure that the objects have been destroyed.

Bill
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Why did you write that empty constructor in the Tree class?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!