1.

How To Prevent A Child Class From Being Serialized When It's Parent Class Already Implements Serializable Interface?

Answer»

When the parent implements serializable then the child Class also be serializable ALTHOUGH it doesn't IMPLEMENT Serializable interface.

As a workaround, implement writeObject() and readObject() METHOD in the child class and throw NOTSERIALIZABLEEXCEPTION from those methods.

When the parent implements serializable then the child Class also be serializable although it doesn't implement Serializable interface.

As a workaround, implement writeObject() and readObject() method in the child class and throw NotSerializableException from those methods.



Discussion

No Comment Found