The clone method works the same for any object. It checks that the class of the object on which was invoked implements Cloneable, otherwise throws CloneNotSupportedException. Then creates another object of the same class as "this" object, and copies the
content of its instance fields to the clone object. If the field is a primitive the value of such variable is copied. If the field is of reference type, again the content of such variable is copied. The content of a variable that points to an object is the address of that object, a pointer to it. Thus the both the clone object, anf the cloned one share the same non-primitive fields. Because the objects pointed to by such fields are not copied themselves, but only the pointers to them.
The fields of an array object are its length and elements hold by the array. If these elements are primitives the two objects receive separate values of such elements. However if the elements are objects the clone and cloned objects share them as I explained above.
Read the API for Object.clone() and
Cloning Objects by Bruce Eckel if you are interested.
[ April 27, 2003: Message edited by: Jose Botella ]