SCJP 6 | SCWCD 5
SCJP6
SCJP6
SCJP6
Jason Irwin wrote:d - Impossible to tell
The object ref at line 5 will be reassigned on each loop, so before it goes out of scope there will be 4 old objects on the heap.
The object created at line 6 has no reference, so is instantly eligible.
However, there is no way of knowing if gc has already run, when it ran and thus how many objects remain on the heap for collection.
SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Lukas Smith wrote:OK, but assume that GC would run after System.gc(), how many objects would be eligible?
SCJP6
no wonder he is so sad, he hasn't seen this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|