Question about the clone() method
The java.lang.Object class is the superclass of all classes, this means that all classes are subclasses of this and inherit all it's methods. The clone() method of Object class is protected which means that is inherited to all classes and is accessible from all the subclasses of Object class (that is from all classes anywhere) that are in any package. So why must someone override it in a class, and much more, make it public so as to use it and to inherit it to it's subclasses???. Since it is already protected in Object, it should have been inherited to all classes in any package, because these are subclasses of Object, and protected methods are inherited to all subclasses in any package.
Can someone clarify this, and help me understand it??
Thanks beforehand.
|