1

How is clone() method in Object class knows which class/fields must be cloned? For example how Objcet.super() can know that I need to serialize exactly A class or B class if I don't put any arguments in it? clone() defined as nativ son I can not see it's implementstion

class A implements Cloneable
{
    public int a = 1;

    @Override
    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }
}
class B extends A
{
    public int b = 2;

    @Override
    public Object clone() throws CloneNotSupportedException
    {
        return super.clone();
    }
}
Denys_newbie
  • 1,140
  • 5
  • 15

0 Answers0