clone()
method in the Object
class is protected, so why I have an error?
public class Test
{
public static void main(String[] args)
{
Test2 c1 = new Test2();
Test2 c2 = (Test2) c1.clone(); // error: clone() has protected access in java.lang.Object
}
}
class Test2 implements Cloneable
{
}