File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
Don't get me started about those stupid light bulbs.
subject: Reference or just a copy?
Similar Threads
Use of memory == less? GC : Soft ref
is there any table like data structure in java ?
Hashtable casting error
Any way to accomplish this ?