posted 21 years ago
If you spend a lot of time around here, you see this similar question come up quite often. The problem with garbage collection is that it is vendor specific, meaning that it's left up to the vendor to implement it accordingly. System.gc() merely suggests to the jvm that it should run the garbage collector, but you can't force anything with it. Some books suggest that you can force it, but it really isn't true. This is a very ambiguos question, and you won't find it on the exam. The kind of gc question you'd find on the exam is when a certain object is eligible for gc. I hope that helps.