Friday 23 April 2010

How to Copy a Object in Java

Duke Waving

What is an easy way to copy a Java object? This example over at StackOverflow shows how to copy an object with a copy constructor or or a copy factory. Both approaches essentially use the new operator and the object's properties to make the copy. Simple yet effective.

No comments:

Post a Comment