Java: What can and what can't be serialized?

前端 未结 9 1005
Happy的楠姐
Happy的楠姐 2020-12-25 11:48

If the Serializable interface is just a Marker-Interface that is used for passing some-sort of meta-data about classes in java - I\'m a bit confused:

After reading t

9条回答
  •  抹茶落季
    2020-12-25 12:30

    NotSerialisable exception is thrown when something in your serializable marked as serializable. One such case can be:

    class Super{}
    class Sub implements Serializable
    {
    Super super;
    

    Here super is not mentioned as serializable so will throw NotSerializableException.

提交回复
热议问题