aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes reference passing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "reference passing" Watch "reference passing" New topic
Author

reference passing

Phungsuk Wangdu
Ranch Hand

Joined: Nov 04, 2009
Posts: 114


1) 10030
2) 20030
3) 209930
4) 10020


i know this code was posted before the answer is 4 but i want to know how do we get 20 in the end didnt we assigned the vh to v so v must also be referring to object referenced by v so value must be 10
Sree Potluri
Ranch Hand

Joined: Aug 12, 2009
Posts: 62
Check this out

http://www.coderanch.com/t/270389/Programmer-Certification-SCJP/certification/Please-anyone-explain-me-this#1256089
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
dude the variable v in your method dies after the another method gets over....but in your amethod the variable v is the one you declared in your amethod....
that is, another method variable v and amethod method v are different

clear?


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Phungsuk Wangdu
Ranch Hand

Joined: Nov 04, 2009
Posts: 114
wow got that
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
all the best
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: reference passing