> Assume we add an object into an ArrayList like this
>
> list.add(new Integer(10));
>
> when will the "new Integer(10)" object get garbage
> collected? there is already no reference for it
Not true. The list is referencing the object.
> and if list object gets garbage collected, are the
> objects it contains also garbage collected
Depends on if somethings else references them or not.