For example I use some collection and method put() which has return type Object.
JavaFAQ Home » General Java
Question: For example I use some
collection and method put() which has return type Object... I do not need it and
do not use it in my program.
Does this Object occupy memory space?
Answer: If it is not referenced - it will
be garbage collected.
And it will stay in memory in opposite case.
The time of garbage collection is not known in advance - it is up to GC (Garbage
Collector) to decide when it can be done.
Printer Friendly Page
Send to a Friend
Search here again if you need more info!