To create a deep copy of Java object you should implement "Cloneable" interface and override clone() method. Here is the sample code:
class MyClass implements Cloneable
{
public Object clone()
{
try
{
return super.clone();
}
catch(CloneNotSupportedException ex)
{
return null;
}
}
}
Tuesday, April 7, 2009
Java Object Clone Sample Code
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment