• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Boone's Exam #65

Ranch Hand
Posts: 1070
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This was taken from Boone's mock exam at:
Question #65
Question 65: Which statements about garbage collection are true?
Select all valid answers.
a.You can directly free the memory allocated by an object.
b.You can directly run the garbage collector whenever you want to.
c.The garbage collector informs your object when it is about to be garbage collected.
d.The garbage collector reclaims an object´┐Żs memory as soon as it becomes a candidate for garbage collection.
e.The garbage collector runs in low-memory situations.
He gives the answer as b,c,e
B is wrong though because while you can request the GC to run, you can not enforce it to run whenever you want to.
C I am not sure about, can anyone help me with that one.
E I know is true.
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bill,
Think you're right about b; if it read "You can directly invoke the gc.." then it would be true. Using 'run' is, IMHO, misleading.
As to c, according to Jamie Jaworski in Java 2 Certification one of the gc's activities is:
Informing selected objects that they are no longer in use and that they should release any nonmemory resources.
I think the informing bit has to do with the gc calling <code>finalize()</code> before destroying the object; since the Java Programming Language by Gosling and Arnold says the <code>finalize</code> method should be used to clean-up any non-memory items.
Hope that helps.
The cure for boredom is curiosity.
There is no cure for curiosity.
-- Dorothy Parker
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic