If I have B extends A… and A implements Serializable, do I have to write “B implements Serializable” ?
I think no, but I would like confirmation…
also if I put serialization id in A… do I need to put one in B also ? should serialization id in A be protected (not private) ?
Yes. Subclass need not be marked serializable explicitly.
And, marking id as
protectedwill do (from compiler perspective).But, as good practice every class should have it’s own private
serialVersionUID.