Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
I hope you know the difference between stack and heap.
objects are always created on heap not stack. Stack only have reference variables for the object and local variables. So, how can they be garbage collected?
until an object is refered by a variable on currently on stack, it is not eligible for garbage collection unless it is forming an island with others.
Raju Champaklal wrote:i thought stack variables go for gc would mean objects being referred by those variables
No its not like that, stack is different from heap. GC is applicable only to heap. When a stack variable goes out of scope, the object referenced by it may or may not be eligible for GC, but the statement in master exam is not concerned with that...
Raju Champaklal wrote:hey is this right that only when the method returns will the stack variables object will be gc....
GC is not applicable to stack variables. The objects in the heap referenced by stack variables might be eligible for GC when method returns. The reason I used the work might is because the objects referenced by stack variables might be referenced somewhere else, so in that case they won't be eligible for GC...