Question
How can you force an object to be garbage collected?
- A. Invoke its
finalize()
method. - B. Remove all references to the object.
- C. Use all memory that is available to the program.
- D. You cannot force an object to be garbage collected.
D.
Note
The garbage collector operates in a non-determined manner.
It cannot be forced to garbage collect a specific object.
PreviousNextRelated