You don't have to explicitly mark the derived as Serializable it will be inherited. However, the serialVersionUID from the parent, although inherited, will not be used by the serialization process. If you don't add a serialVersionUID to the child one will be generated.
See Below:
public class A implements Serializable {
protected static final long serialVersionUID = 1L;
}
public class B extends A {
}
public class Main {
public static void main(String[] args){
A a = new A();
B b = new B();
Class aClass = a.getClass();
Class bClass = b.getClass();
long aUid = ObjectStreamClass.lookup(aClass).getSerialVersionUID();
long bUid = ObjectStreamClass.lookup(bClass).getSerialVersionUID();
System.out.printf("serialVersionUID:\n");
System.out.printf("b inherited from a: %d\n", b.serialVersionUID);
System.out.printf("a used by serialization: %d\n",aUid);
System.out.printf("b used by serialization: %d\n",bUid);
}
}
Output:
serialVersionUID:
b inherited from a: 1
a used by serialization: 1
b used by serialization: -3675232183873847366