Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic