• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic