I always thought that clone() creates an object without calling a constructor.
But, while reading Effective Java Item 11: Override clone judiciously, I found a statement which says that
The provision that “no constructors are called” is too strong. A well-behaved clone method can call constructors to create objects internal to the clone under construction. If the class is final, clone can even return an object created by a constructor.
Can someone please explain this to me?
clone()method not calls constructor, its default behavior is it will perform shallow copy. but if we want to perform deep copy we need to overrideclone()method , from which we can return new Object.