my dog learned polymorphism
The moose likes Beginning Java and the fly likes Reference or just a copy? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Reference or just a copy?" Watch "Reference or just a copy?" New topic

Reference or just a copy?

David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
If I do a get out of a hashtable and modify a member variable of the returned object, will that modification be mirrored in the hashtable or do I have to do a 'put' again?
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
The hashtable returns a reference to the original object, not a copy - so it's been modified now. No need for a put.

"I'm not back." - Bill Harding, Twister
I agree. Here's the link:
subject: Reference or just a copy?
It's not a secret anymore!