I wonder if some one please could clear my confusion.
I have a class which dont implements clonable interface but override a clone method .
When I try to clone the object of my class , it runs fine with no compiler error nor any exception.
-So how will end user know that cloning has heppened properly or not?
-why clone method has been provided in object , why not in clonable?
- if they would not make clonable a marker interface , by providing clone method inside interface , implementers of clonable interface HAS TO implement clone method and user would be sure that cloning has happened because it has implemented clonable and over riddedn clone method?
The java.lang API suggests that you implement Cloneable with a public clone() method,
overriding Object's protected clone() method. This offers added assurance that the clone
operation is properly implemented for your class.