Email address:
Password:
SCJP/OCPJP 1.6 certification
Practice Exams and Training
SCJP Online Training » Discussions

Question related to GC

Draw a small diagram or a sketchy illustration to see how many objects are eligible for the GC.

Could you give me example of that diagram.

Assuming you have already watched our garbage collection video, it would basically be like this at the end:



The trick is with the part which gives you the illusion that you are setting nulls:


for(Studio st:s){
    st=null;
}


This code actually does nothing because 'st' is only a local variable scoped for for loop. To set s1, s2, s3, or s3 null, you really need to pass null right to that reference.

ExamLab © 2008 - 2024