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

Explain me this

15. s1.a1.a2.a2=new A();

17. s1.a2.a1.a2=null;


is both are same?In this questions only one object dont have reference ie s1.a2.a1.a2=null how the output is 2 ?

The two statements do not represent or refer the same object.


As you set the s1.a2.a1.a2 reference to null, it isolates two objects, one that has been referred by that reference, and the object that has been referred by the 'a2' of that object.


Since you have access to our videos, have you watched our garbage collection video?

http://www.examlab.org/v/garbage-collection

ExamLab © 2008 - 2024