JB Nizet's answer is correct. But also, just in case you tried to override Object.clone() , remember that the official way to clone objects in Java looks something like this:
class A implements Cloneable { String id; Enum state; int flags; public A clone() { A ret = (A) super.clone(); ret.id = id; ret.state = state;
Note that you must call (A) super.clone() instead of new A() and that your class must implement the Cloneable interface.
source share