posted 14 years ago
Hi Mohammed,
the first one prints "10"
This creates a new ValHold() and assigns to v; so v.i is 10.
second one prints local variable "i" and it is "0"
This method is trying to assign a new reference to the passed one. However it CANNOT change the original reference "v". But the "v.i = 20; " is still valid because the calling method can change the values of member variables (but not the reference). So the third one prints 20.
SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3,OCJP8 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator