• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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
 
I think she's lovely. It's this tiny ad that called her crazy:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic