Shanky Sohar wrote:what i think is
super.clone() return a shallow copy of the current object.
in order to get a deep copy we have to do the type casting..
By this you meant that
If a shalllow copy of object is created we will have problems like .
1) If a (shallow) copy of class object is than it would contain refrences of objects which point to the same original object when their copy is made.
So if we change the value of instance variable in the copy of the object it would change the value in the original object.
2) If we clone a object and it contains a reference to the I/O Stream than the copy would also contain the reference to the same stream.
And if we deep copy it
The object copied would contain references to the new objects, rather than the original.
Please give a nodd at this , else give me an example of deep copy and shallow copy
Thankyou Shanky sohar