Under what circumstance would you want your child class to avoid serializable if parent is serializable?
问题 class Parent implements Serializable{ ........ } class Child extends Parent{ private void writeObject(ObjectOutputStream oos) throws IOException { throw new NotSerializableException(); } private void readObject(ObjectOutputStream oos) throws IOException { throw new NotSerializableException(); } } The above code shows how child avoids Serializable if the parent is already implemented Serializable . It seems to be a bad design and confusing at some points, so I am wondering in what circumstance