Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Object which eligible to garbage collected

 
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all, i have a question from a mock exam
Which of these statements are true?
Select 1 correct answer
a. Objects can explicitly be destroyed using the keyword delete
b. An object will be garbage collected immediately after the last referene to the reference to the object is removed
c. if object obj1 is accessible from obj2 and obj2 is accessible from obj1, than obj1 and obj2 are not eligible for garbage collection
d. Once an object has become eligible for garbage collection, it will remain eligible until it is destroyed
e. An bject can be finalized only once
The answer is e.
Why is answer c and d wrong?
daniel
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
c. if both objects are unreachable, then they may be garbage collected.
d. the finalize method may resurrect an object...
Here is a very interesting article about garbage collection. I think you should read it:
http://developer.java.sun.com/developer/technicalArticles/ALT/RefObj
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic