What type of copy does the default java.lang.Object.clone() method perform -


i new java can 1 tell me please.

shallow copy: primitive types , references copied

deep copy: objects copied recursively

there no default implementation clone()

you can @ documentation clone():

the method clone class object performs specific cloning operation. first, if class of object not implement interface cloneable, clonenotsupportedexception thrown. note arrays considered implement interface cloneable , return type of clone method of array type t[] t[] t reference or primitive type. otherwise, method creates new instance of class of object , initializes fields contents of corresponding fields of object, if assignment; contents of fields not cloned. thus, method performs "shallow copy" of object, not "deep copy" operation.


Comments

Popular posts from this blog

Need help in packaging app using TideSDK on Windows -

java - Why does my date parsing return a weird date? -

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -