Making Child classes as Non Serializable in java

前端 未结 7 1244
無奈伤痛
無奈伤痛 2020-12-09 16:43

I have a class which implements Serializable. Now I extends this class and I want this extended class to be non Serializable. So how to do it?

For example. I have

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 17:35

    It will always be Serializable, though you could ensure nothing in the class ever gets serialized by making every member transient.

提交回复
热议问题