On 9/30/05, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
>
> I'm not sure it is a stupid question... I guess this enters the realm of
> generic Java question, but I can't say I've ever thought about this
> before... what happens if you have a class that implements serializable,
> and you then extend that class and add a member that is NOT serializable?
> Does that get flagged at compile-time?


No. It is an error but it will be detected only at runtime.
A NotSerializableException will be thrown when an instance of the subclass
is serialized.

If you extend a class that is flagged to be Serializable, you must assure
that all the members are Serializable.
Adding a non Serializable member to a subclass of a Serializable class is
the same thing
as adding a non Serializable member to the Serializable class. And that's an
error which will
be detected at runtime.

Tamas

Reply via email to