This week's book giveaway is in the Other Languages forum. We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line! See this thread for details.
what does the above code do?? does it make one reference variable a and assign it a new Animal object during each iteration. and in the end we have 20 Animal objects added to aList and a refers to the last one and other 19 left without any reference??
posted 8 years ago
Yes, 20 Animal objects are created, and after the loop is done, they are all eligible for garbage collection since they are not referenced.