开发者

Is serialVersioUID require in Interfaces(I hope not)?

开发者 https://www.devze.com 2022-12-31 00:54 出处:网络
My understanding is serialVersionUID is applicable only to classes,开发者_运维百科 because we can create an object only to classes and the concept of serialVersionUID is for object serialization and d

My understanding is serialVersionUID is applicable only to classes,开发者_运维百科 because we can create an object only to classes and the concept of serialVersionUID is for object serialization and deserialization.


It is not required, and more importantly, it will not have any effect on how serialization works in your application.

Since serialVersionUID should be static, even if you add it to your interface, it won't be inherited, so you'll need to add one to your implementing class, too. Similarly, if you extend a serializable base class, you need to add serialVersionUID again.

0

精彩评论

暂无评论...
验证码 换一张
取 消