Explicitly extending Object class and calling clone method of object throwing error
- by Suresh S
i tried the following code for cloning the object. while compiling it shows clone is protected and cannot be accessed, but i had extended Object class, hence the clone method will be public to my class . please explain me the reason.
class storeDate extends Object {
public static void main(String[] args)
{
storeDate d = new storeDate();
Object o = (storeDate)d;
o.clone():
}
}