How many objects will be eligible for garbage collection after the execution of line 9 in the following code?
Choose one answer.
a. 8
b. 14
c. 15
d. 16
It should be 15.
The first Object of type Double is created at Line 5
and then another 15 Objects of type Double are created in the nested loops from lines 6 to 8
So, there are 16 objects in total, variable x referring to the last Double object with value i+j=4+2=6.
variable a is a primitive, and not an Object.
So, you have 15 objects available for GC
OCPJP6
What's that smell? I think this tiny ad may have stepped in something.
a bit of art, as a gift, that will fit in a stocking