Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reference passing

 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Phungsuk Wangdu
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow got that
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all the best
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic