la fyuan

Greenhorn
+ Follow
since Oct 02, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by la fyuan

Seetharaman Venkatasamy wrote:Well, Actually there are 5 objects created, and only 1 object is eligible for GC.

Note* but end of the method , all the above 5 objects will be Garbage Collected.



Thank you. The answer to this question is right!

Hama Kamal wrote:

Question:
How many objects were created?
How many object(objects) is(are) eligible for GC?



4
1


More specific?
Given:
public class Eggs {

public static void main(String[] args) {

Dozens[] da=new Dozens[3];
da[0]=new Dozens();
Dozens d=new Dozens();
da[1]=d;
d=null;
da[1]=null;
}

}

class Dozens{
int []dz={1,2,3,4,5};
}


Question:
How many objects were created?
How many object(objects) is(are) eligible for GC?