1) There are 10 objects eligible for GC.
obj is declared inside the loop, so its scope is inside the loop, so after the loop is completed, it goes out of scope, thus the object referenced by it is also eligible for GC.
2) I also think 0 objects are eligible for GC.
3) Again I also think 0 objects are eligible for GC. There is actually only one object here which is the int array, and it doesn't goes out of scope or is not set to null.
4) I think 0 objects are eligible for GC. Read
this for more info...
[Beaten by just 1 second

]