|
Object variables in Java are references (similar to pointers in C). If you need an independent copy of an object you need to make it; this is usually done by implementing the Cloneable interface and overriding the clone method to create and return a new copy of the object. You might also want to investigate the difference between a "shallow" copy and a "deep" copy.
|